issues
search
SupinePandora43
/
UltralightNet
.NET bindings for Ultralight next-gen HTML renderer
https://github.com/SupinePandora43/UltralightNet
MIT License
63
stars
10
forks
source link
Benchmark ULString
#44
Closed
SupinePandora43
closed
2 years ago
SupinePandora43
commented
2 years ago
Benchmarks
Marshal.AllocHGlobal and Encoding.GetBytes
Cashed Marshal.AllocHGlobal and Encoding.GetBytes
Marshal.StrToCoTaskMem
stackalloc and Encoding.GetBytes
Ultralight.ulCreateString
Results
:P
Faster than run-time heap allocation
No
Same as Cached memory
Slow on short lengths (0-1) fast in all other cases.
Verdict
[x] Use ulCreateString16 for managed->native calls
don't use if/else size checks because they will probably lower performance (correct me in future)
Pros
blazingly fast
Cons
slower on nano lengths (0-16~ bytes)
Benchmarks
Results
Verdict
Pros
Cons