Commit Graph

2087 Commits

Author SHA1 Message Date
Marc Tiehuis
2659ac01be Add Sha2 functions
We take the fastest time measurement taken across multiple runs. Tested
across multiple compiler flags and the best chosen.

```
Cpu: Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
Gcc: 7.2.1 20171224
Clang: 5.0.1
Zig: 0.1.1.304f6f1d
```

See https://www.nayuki.io/page/fast-sha2-hashes-in-x86-assembly.

```
Gcc -O2
    219 Mb/s
Clang -O2
    213 Mb/s
Zig --release-fast
    284 Mb/s
Zig --release-safe
    211 Mb/s
Zig
    6 Mb/s
```

```
Gcc -O2
    350 Mb/s
Clang -O2
    354 Mb/s
Zig --release-fast
    426 Mb/s
Zig --release-safe
    300 Mb/s
Zig
    11 Mb/s
```
2018-01-13 22:37:47 +13:00
Andrew Kelley
a2315cfbfc
Merge pull request #686 from zig-lang/md5-sha1
Add Md5 and Sha1 functions
2018-01-13 00:00:33 -05:00
Marc Tiehuis
51fdbf7f8c Add Md5 and Sha1 hash functions
Some performance comparisons to C.

We take the fastest time measurement taken across multiple runs.

The block hashing functions use the same md5/sha1 methods.

```
Cpu: Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
Gcc: 7.2.1 20171224
Clang: 5.0.1
Zig: 0.1.1.304f6f1d
```

See https://www.nayuki.io/page/fast-md5-hash-implementation-in-x86-assembly:

```
gcc -O2
    661 Mb/s
clang -O2
    490 Mb/s
zig --release-fast and zig --release-safe
    570 Mb/s
zig
    50 Mb/s
```

See https://www.nayuki.io/page/fast-sha1-hash-implementation-in-x86-assembly:

```
gcc -O2
    588 Mb/s
clang -O2
    563 Mb/s
zig --release-fast and zig --release-safe
    610 Mb/s
zig
    21 Mb/s
```

In short, zig provides pretty useful tools for writing this sort of
code. We are in the lead against clang (which uses the same LLVM
backend) with us being slower only against md5 with GCC.
2018-01-13 14:40:21 +13:00
Marc Tiehuis
304f6f1d01 Add integer rotation functions 2018-01-13 13:23:12 +13:00
Andrew Kelley
3268276b58 the same string literal codegens to the same constant
this makes it so that you can send the same string literal
as a comptime slice and get the same type
2018-01-11 21:02:30 -05:00
Andrew Kelley
465e75bc5a
Merge pull request #682 from zig-lang/fix-endian
Fix endian swap parameters
2018-01-11 02:51:17 -05:00
Marc Tiehuis
899e36489d Fix endian swap parameters 2018-01-11 19:50:08 +13:00
Andrew Kelley
891c93c118
Merge pull request #681 from zig-lang/hw-math
Add hw sqrt for x86_64
2018-01-10 10:22:40 -05:00
Andrew Kelley
d4f791cf6c
Merge pull request #680 from zig-lang/intrusiveLinkedList
Intrusive linked lists
2018-01-10 10:13:15 -05:00
Marc Tiehuis
24cd99160c Add hw sqrt for x86_64 2018-01-10 19:53:36 +13:00
Andrea Orru
19343db593 Intrusive linked lists 2018-01-10 00:33:07 -05:00
Andrew Kelley
3c094116aa remove %% prefix operator
See #632
closes #545
closes #510

this makes #651 higher priority
2018-01-09 00:51:51 -05:00
Andrea Orru
98a95cc698 exit, createThread for zen 2018-01-08 12:16:23 -05:00
Andrew Kelley
598170756c a catch unreachable generates unwrap-error code
See #545
See #510
See #632
2018-01-07 18:13:54 -05:00
Andrew Kelley
632d143bff replace a %% b with a catch b
See #632

better fits the convention of using keywords for control flow
2018-01-07 17:28:20 -05:00
Andrew Kelley
66717db735 replace %return with try
See #632

better fits the convention of using keywords for control flow
2018-01-07 16:53:13 -05:00
Andrea Orru
de1f57926f Merge branch 'master' of github.com:zig-lang/zig 2018-01-07 04:43:15 -05:00
Andrea Orru
3182857224 Adding zen support 2018-01-07 04:43:08 -05:00
Andrew Kelley
32ba0dcea9 update hello world docs 2018-01-07 01:59:23 -05:00
Andrew Kelley
e7c04b6df2 add a test for returning a type that closes over a local const
closes #552
2018-01-07 00:50:43 -05:00
Andrew Kelley
bb39e503c0 fix struct inside function referencing local const
closes #672

the crash and compile errors are fixed but structs
inside functions still get named after the functions
they're in. this will be fixed later.
2018-01-07 00:28:37 -05:00
Andrea Orru
ad438cfd40 Merge branch 'master' of github.com:zig-lang/zig 2018-01-06 23:13:51 -05:00
Andrea Orru
e932919e68 Darwin -> MacOSX, added Zen. See #438 2018-01-06 23:10:53 -05:00
Andrew Kelley
a9d2a7f002
Merge pull request #674 from Hejsil/readInt-calling-fix
Fixed calls to mem.readInt
2018-01-06 19:45:08 -05:00
Jimmi Holst Christensen
e91136d61f Fixed the call to mem.readInt in endian.swap 2018-01-07 00:24:35 +01:00
Jimmi Holst Christensen
6f85c860c6 Fixed the call to mem.readInt in Rand.scalar 2018-01-07 00:24:17 +01:00
Andrew Kelley
dde7cc52d2 fix exp1m implementation
in the llvm6 branch with assertions on, it failed the test
this fixes it
2018-01-06 02:58:45 -05:00
Andrew Kelley
17e68c4a11 disable NewGVN
closes #673
2018-01-06 00:15:37 -05:00
Andrew Kelley
e08a4ea62d Merge branch 'appveyor' 2018-01-05 12:16:16 -05:00
Andrew Kelley
2c35e24bd9 workaround for microsoft releasing windows SDK with wrong version 2018-01-05 11:35:46 -05:00
Andrew Kelley
79d50d9933 appveyor: enable verbose link for self hosted compiler 2018-01-04 23:43:46 -05:00
Andrew Kelley
f377b1e886 Revert "appveyor ci: look for newer windows sdk version"
This reverts commit 31d632b72e.

according to
https://developer.microsoft.com/en-us/windows/downloads/sdk-archive
10240 is actually 26624 and there was some kind of versioning issue.
2018-01-04 23:37:21 -05:00
Andrew Kelley
7f0b12a481 appveyor: skip building self hosted compiler for now 2018-01-04 23:30:03 -05:00
Andrew Kelley
25ad0b47e2 appveyor: try using vcvarsall 2018-01-04 23:11:27 -05:00
Andrew Kelley
d1ef17e3cd appveyor: set VCINSTALLDIR 2018-01-04 22:59:39 -05:00
Andrew Kelley
1b120d1e49 update windows build to llvm 5.0.1
llvm-config.exe does not handle diaguids.lib for us so we have to
duplicate the work.
2018-01-04 22:46:26 -05:00
Andrew Kelley
21a552682e Revert "try using appveyor's llvm copy"
This reverts commit 35dc987dc8.
2018-01-04 19:06:48 -05:00
Andrew Kelley
35dc987dc8 try using appveyor's llvm copy 2018-01-04 18:54:46 -05:00
Andrew Kelley
31d632b72e appveyor ci: look for newer windows sdk version 2018-01-04 18:34:42 -05:00
Andrew Kelley
7e65fe7ac3 fix test regressions on windows from previous commit 2018-01-04 16:36:59 -05:00
Andrew Kelley
d008e209e7 self-hosted compiler works on macos 2018-01-04 15:30:22 -05:00
Andrew Kelley
e1c03d9e8e self-hosted compiler works on windows
* better error message for realpath failing
 * fix bug in std.io.readFileAllocExtra incorrectly returning
   error.EndOfStream
 * implement std.os.selfExePath and std.os.selfExeDirPath for windows
2018-01-04 13:48:45 -05:00
Andrew Kelley
0cd63b28f3 fix self-hosted build on windows 2018-01-03 22:38:13 -05:00
Andrew Kelley
477e3f64fc self-hosted build: use llvm-config from stage1 2018-01-03 21:32:50 -05:00
Andrew Kelley
5c8600d790 add december in review to reading material; fix docs 2018-01-03 21:11:58 -05:00
Andrew Kelley
5a800db48c build: std files and c header files are only specified once
In the CMakeLists.txt file. And then we communicate the list
to the zig build.
2018-01-03 19:39:04 -05:00
Andrew Kelley
a45db7e853 add building the self hosted compiler to the main test suite 2018-01-03 18:25:17 -05:00
Andrew Kelley
5b156031e9 enum tag values are expressions so no parentheses needed 2018-01-03 16:05:37 -05:00
Andrew Kelley
5c988cc722 readme: update macos installation instructions 2018-01-03 14:16:20 -05:00
Andrew Kelley
36ff26609b fix self hosted compiler on windows 2018-01-03 04:55:49 -05:00