OrangeC icon indicating copy to clipboard operation
OrangeC copied to clipboard

Using more optimized versions of the stdlib functions for different platforms or in general

Open chuggafan opened this issue 6 years ago • 2 comments

PR #317 reminded me that the library really needs upgrading, I found out that agner fog (Guy who writes a LOT of optimization books for many x86 and x64 arches) has created an assembly optimized library for a lot of the most used STDLIB functions.

https://agner.org/optimize/ is his website, and specifically his collection of sources (GPLv3 licensed, which is perfectly compatible with what we have) under his "subroutine" library is highly optimized for each CPU instruction set, works with popcount, strlen, strcpy, toupper, tolower (though for these two it doesn't do locale), strstr, strspn, stricmp, strcmp, strcat, memset, memmove, memcpy, and memcmp. It's near-perfect for our uses and can actually do dispatching on it's own depending on the arch of the computer running it. It also has the advantage by being in NASM syntax, which OASM uses, meaning that minimal changes should be needed to use it.

chuggafan avatar Jan 17 '19 18:01 chuggafan

cool... that also gives a small start on the x64 support, which I want to do one day lol!

LADSoft avatar Jan 17 '19 23:01 LADSoft

Yhea... main issue I found though was that not all functions support STDCALL, specifically the one's we'd want to use, so we'd probably have to change that (albeit that shouldn't be too hard). Other than that it seems pretty good for our purposes.

chuggafan avatar Jan 18 '19 00:01 chuggafan