Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/etcimon/fast
A library for D that aims to provide the fastest possible implementation of some every day routines.
https://github.com/etcimon/fast
dlang
Last synced: about 2 hours ago
JSON representation
A library for D that aims to provide the fastest possible implementation of some every day routines.
- Host: GitHub
- URL: https://github.com/etcimon/fast
- Owner: etcimon
- Created: 2013-07-01T12:03:44.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2023-03-03T15:00:21.000Z (over 1 year ago)
- Last Synced: 2024-08-04T01:03:47.864Z (4 months ago)
- Topics: dlang
- Language: D
- Size: 153 KB
- Stars: 111
- Watchers: 9
- Forks: 7
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-d - fast.json - A library for D that aims to provide the fastest possible implementation of some every day routines. (Data serialization / JSON)
README
fast
====This library aims to provide the fastest possible implementation of some every day routines.
The contained functions avoid GC allocations and input validation. They may use SSE or stack allocations to reach a high throughput so that in some cases a 20 fold speed increase can be achieved.
**[DMD](https://dlang.org/)**, **[GDC](https://gdcproject.org/)** and **[LDC2](https://wiki.dlang.org/LDC)** compilers are supported. Tested with front-end versions **2.068** through **2.079**.
### Benchmark
A benchmark is included and can be run through dub, e.g.:dub --config=benchmark --build=release --compiler=gdc
### Examples
##### Read JSON file with coordinates.
```d
struct Point3D { double x, y, z; }void main()
{
import fast.json;
auto points = json.coordinates.read!(Point3D[]);
}
```##### SSE3 accelerated splitting around '/' and '\'
```d
string rest = pathname
string element;import fast.string;
while (rest.split!`or(=\,=/)`(element, rest))
{
// `element' is now the next directory.
// `rest' is what remains after the \ or /.
}
// `element` is now the file name part of the path.
```##### Calling Windows API functions.
```d
void createHardlink(string from, string to)
{
import fast.cstring : wcharPtr;
CreateHardLinkW(wcharPtr!to, wcharPtr!from, null);
}
```##### Calling Linux API functions.
```d
void createHardlink(string from, string to)
{
import fast.cstring : charPtr;
link(charPtr!from, charPtr!to);
}
```