A 100LOC C impl of memset, that is faster than glibc's
1–10 of 110 posts
Re: A 100LOC C impl of memset, that is faster than glibc's
#2Re: A 100LOC C impl of memset, that is faster than glibc's
#3Re: A 100LOC C impl of memset, that is faster than glibc's
#4Re: A 100LOC C impl of memset, that is faster than glibc's
#5Re: A 100LOC C impl of memset, that is faster than glibc's
#6Re: A 100LOC C impl of memset, that is faster than glibc's
#7In all fairness it needs to be said that the libc's implementation has to consider portability to more "exotic" architectures. For example, not every CPU allows to make unaligned 32-bit or 64-bit writes, or it takes a huge penalty for such writes.
Re: A 100LOC C impl of memset, that is faster than glibc's
#8For background: https://faculty-web.msoe.edu/johnsontimoj/EE4980/files4980/m... Since 1993 ram chips have integrated state machines receiving and interpreting higher level commands. They also have wide sense amplifier banks being loaded/stored all at once.
Re: A 100LOC C impl of memset, that is faster than glibc's
#9memset is something JEDEC SDRAM standard should of implemented on a hardware level back in 1993. Why even bother writing to ram byte by byte when we could of had dedicated command to fill up to whole row (8-16kbit per chip, 8-32KB per DIMM) at a time with _single command_. Safe zero fill memory allocation would be free and standard. For background: https://faculty-web.msoe.edu/johnsontimoj/EE4980/files4980/m... Since…
Zen has CLZERO which can clear a cacheline in one go, but not sure how good it is.
Re: A 100LOC C impl of memset, that is faster than glibc's
#10In all fairness it needs to be said that the libc's implementation has to consider portability to more "exotic" architectures. For example, not every CPU allows to make unaligned 32-bit or 64-bit writes, or it takes a huge penalty for such writes.