do we want inline C functions in Onion?

10 views
Skip to first unread message

Basile Starynkevitch

unread,
Jul 3, 2018, 2:09:28 PM7/3/18
to onion-dev
Hello all,


We don't have any inline C functions in Onion, and that is ok for me. I
don't care that much about performance (and I am guessing that only a
few percent of performance might be winned by inlining some functions)


However, some functions (obviously onion_request_get_path, but also
several others) might take advantage of being declared as inline, and
implemented in some header file. Do we want that? I personally don't.



Cheers

--
Basile STARYNKEVITCH == http://starynkevitch.net/Basile
opinions are mine only - les opinions sont seulement miennes
Bourg La Reine, France

David Moreno Montero

unread,
Jul 4, 2018, 11:27:11 AM7/4/18
to Basile Starynkevitch, onion-dev
I wouldn't do it:

1. A function call is not very expensive and easily pipelined by the processor. Most of the time the processor is waiting for memory; get_path et all should be quite close to the main onion code, so should be in cache. Benchmarking should be done to really get data.
2. If somebody really really needs a lot of speed i would recommend compile all onion into one .c file (check -CMAKE_BUILD_TYPE=Fast for example) and all your c files as well, and let the compile inline as required. And do LTO and PGO.
3. And most important: That would make the structs part of the API, which I certainly want not.

So my vote is no inlines.

--
You received this message because you are subscribed to the Google Groups "onion-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to onion-dev+unsubscribe@coralbits.com.
To post to this group, send email to onio...@coralbits.com.
Visit this group at https://groups.google.com/a/coralbits.com/group/onion-dev/.
For more options, visit https://groups.google.com/a/coralbits.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages