flat assembler
Message board for the users of flat assembler.
Index
> Main > optimizing c lib functions |
Author |
|
vid 14 Mar 2009, 21:00
which implementation of libc do you plan to optimize?
|
|||
14 Mar 2009, 21:00 |
|
rugxulo 15 Mar 2009, 01:39
FlashBurn wrote: I need to know for which cpu it is a good idea to optimize for. Compilers such as GCC or OpenWatcom do a pretty good job for 586 and 686, so your best bet is to target either small size or something less utilized by most C libs (e.g. MMX, 3dnow!, SSE[1234]). Of course, the real defining factor is what your movitation is, how much skill and persistence you have, and what cpus you intend to use / test on. So really, the choice has already been made (almost) for you! |
|||
15 Mar 2009, 01:39 |
|
bitRAKE 15 Mar 2009, 01:55
It might be advisable to look at a project like GMP and see how they've organized the optimizations for multiple CPUs. Although we are concerned with x86 variants many of the same ideas are applicable, and ease adoption of future CPUs. In general algorithm selection is based on CPU identification and performance tests while allowing specific selection where the programmer knows better.
So, I suggest creating a framework to plug implementations into and not selecting a specific CPU. Or maybe a solid implementation will give better guidance as to what the framework should consist of? |
|||
15 Mar 2009, 01:55 |
|
DOS386 15 Mar 2009, 02:45
FlashBurn wrote: optimized functions of the most used c lib functions COOL. Quote: For example, I take the memcpy function. And MOVSD can't be used since it's exclusively possessed by King Hutch and the lower code is faster Quote: I hope you get what I want. Maybe this could also be a thread for collecting the most optimized functions. Indeed. Some info about how to decrypt C syntax and translate it to FASM would be nice. Vid wrote: Quote: which implementation of libc do you plan to optimize? What is around at all ? |
|||
15 Mar 2009, 02:45 |
|
FlashBurn 15 Mar 2009, 08:38
@vid
1st I plan to have optimized variants of the string and memory functions. @rugxulo I don´t like the code that compilers produce and I like to use mmx and sse instruction where it is faster, so I have to write it myself/use others code |
|||
15 Mar 2009, 08:38 |
|
vid 15 Mar 2009, 14:32
Quote: 1st I plan to have optimized variants of the string and memory functions. That's not what I asked about. I asked which implementation of libc you want to optimize. GNU libc implementation, MS libc implementation, tinylibc, etc??? |
|||
15 Mar 2009, 14:32 |
|
FlashBurn 15 Mar 2009, 21:26
I have to say that I don´t know if there would be any difference. I thought it is equal which libc I like to optimize, because I have to port it to my os and for the kernel I do not want to use a whole libc, but I only want to write/use the functions I need. So for my kernel it makes no difference which libc I will use and for my os I think I will use glibc, because it makes porting other apps easier.
At the moment I use my own c code, but as I said, I want to use asm code and want to have optimized versions. If that doesn´t answer your question I don´t get the point |
|||
15 Mar 2009, 21:26 |
|
rugxulo 17 Mar 2009, 03:09
FlashBurn wrote: for my os I think I will use glibc, because it makes porting other apps easier. No offense, but I think GLIBC is extremely huge and bloated, way too complex for your needs. And there are many other C libs that are more portable, even. Perhaps newlib, but I've never investigated it honestly, so maybe I'm way off-base. (I think GNU libc mainly focuses on Linux variants and Hurd, nothing else.) |
|||
17 Mar 2009, 03:09 |
|
f0dder 19 Mar 2009, 12:55
If you're writing a kernel, you probably don't want to use libc for it - large parts of libc doesn't make sense inside the kernel, and you definitely want to avoid str* functions like the plague.
So, decide on what functionality your kernel needs, then write routines that make sense, and optimize as necessary. No reason to spend time optimizing a c-style strlen if you can use counted strings and do a "mov eax, [string.size]". |
|||
19 Mar 2009, 12:55 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.