8000 Minor tweaks on fallback. · JavaScriptExpert/simdjson@e3a4fd9 · GitHub
[go: up one dir, main page]

Skip to content

Commit e3a4fd9

Browse files
lemirejkeiser
authored andcommitted
Minor tweaks on fallback.
1 parent 5a071c1 commit e3a4fd9

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ architecture:=$(shell arch)
1818
###
1919
ifeq ($(architecture),aarch64)
2020
ARCHFLAGS ?= -march=armv8-a
21-
else
22-
ARCHFLAGS ?= -msse4.2 -mpclmul # lowest supported feature set?
21+
## It should no longer be necessary to specify anything under x64
22+
# else
23+
# ARCHFLAGS ?= -msse4.2 -mpclmul # lowest supported feature set?
2324
endif
2425

2526
CXXFLAGS = $(ARCHFLAGS) -std=c++17 -pthread -Wall -Wextra -Wshadow -Ibenchmark/linux

README.md

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ On a Skylake processor, the parsing speeds (in GB/s) of various processors on th
6969
- We support 64-bit platforms like Linux or macOS, as well as Windows through Visual Studio 2017 or later.
7070
- A processor with
7171
- AVX2 (i.e., Intel processors starting with the Haswell microarchitecture released 2013 and AMD processors starting with the Zen microarchitecture released 2017),
72-
- or SSE 4.2 and CLMUL (i.e., Intel processors going back to Westmere released in 2010 or AMD processors starting with the Jaguar used in the PS4 and XBox One)
72+
- or SSE 4.2 and CLMUL (i.e., Intel processors going back to Westmere released in 2010 or AMD processors starting with the Jaguar used in the PS4 and XBox One),
73+
- or a any other x64 processor (going back to AMD Opteron in 2003 and the Pentium4 Prescott in 2004),
7374
- or a 64-bit ARM processor (ARMv8-A): this covers a wide range of mobile processors, including all Apple processors currently available for sale, going as far back as the iPhone 5s (2013).
7475
- A recent C++ compiler (e.g., GNU GCC or LLVM CLANG or Visual Studio 2017), we assume C++17. GNU GCC 7 or better or LLVM's clang 6 or better.
7576
- Some benchmark scripts assume bash and other common utilities, but they are optional.
@@ -84,28 +85,21 @@ Under Windows, we build some tools using the windows/dirent_portable.h file (whi
8485

8586
## Runtime dispatch
8687

87-
On Intel and AMD processors, we get best performance by using the hardware support for AVX2 instructions. However, simdjson also runs on older Intel and AMD processors. We require a minimum feature support of SSE 4.2 and CLMUL (2010 Intel Westmere or better). The code automatically detects the feature set of your processor and switches to the right function at runtime (a technique sometimes called runtime dispatch).
88+
On Intel and AMD processors, we get best performance by using the hardware support for AVX2 instructions. However, simdjson also runs on older Intel and AMD processors. The code automatically detects the feature set of your processor and switches to the right function at runtime (a technique sometimes called runtime dispatch).
8889

89-
On x64 hardware, you should typically build your code by specifying the oldest/less-featureful system you want to support so that runtime dispatch may work. The minimum requirement for simdjson is the equivalent of a Westmere processor (SSE 4.2 and PCLMUL). If you build your code by asking the compiler to use more advanced instructions (e.g., `-mavx2`, `/AVX2` or `-march=haswell`), then it will break runtime dispatch and your binaries will fail to run on older processors.
90+
On x64 hardware, you should typically build your code by specifying the oldest/less-featureful system you want to support so that runtime dispatch may work. If you build your code by asking the compiler to use more advanced instructions (e.g., `-mavx2`, `/AVX2` or `-march=haswell`), then it may break runtime dispatch and your binaries will fail to run on older processors.
9091

91-
We also support 64-bit ARM. We assume NEON support. There is no runtime dispatch on ARM.
92+
We also support 64-bit ARM (ARMv8-A). There is no runtime dispatch necessary on ARM.
9293

93-
If you expect your code to run on older processors, you can check that the CPU is supported as follows:
94+
You can check which CPU is being detected as follows:
9495

9596
```c++
96-
if (simdjson::active_implementation->name() == "unsupported") {
97-
printf("unsupported CPU\n");
98-
}
97+
simdjson::active_implementation->name(); // returns a descriptive string
9998
```
10099

101-
This check is not useful on ARM processors since all 64-bit ARM processors are supported.
102-
103-
It is not necessary to do this check: if you omit it, you will get back the error code `UNSUPPORTED_ARCHITECTURE` when trying to parse documents.
104-
However, you can call `simdjson::active_implementation->name()` to check which CPU configuration has been detected (e.g., haswell, westmere).
105-
106100
## Computed GOTOs
107101

108-
For best performance, we use a technique called "computed goto", it is also sometimes described as "Labels as Values".
102+
For best performance, we use a technique called "computed goto" when the compiler supports it, it is also sometimes described as "Labels as Values".
109103
Though it is not part of the C++ standard, it is supported by many major compilers and it brings measurable performance benefits that
110104
are difficult to achieve otherwise.
111105
The computed gotos are automatically disabled under Visual Studio.

0 commit comments

Comments
 (0)
0