[go: up one dir, main page]

Menu

#183 soapcpp2: don't use fprintf without %

Patch
closed-rejected
5
2020-03-11
2020-03-08
No

At this point Visual Studio tells me most of the time is spent formatting strings and writing out buffers to the disk (SSD). So, seeing a lot of fprintf calls without any format arguments (no %), I first cursed the lack of C++ as that would've allowed for a simple solution, then went about it using the preprocessor. To avoid upseting code alignment and such, the wrapper macro is called fprints. It exploits the fact that most people would always pass string litterals to fprintf and that means the compiler can calculate the string length at compile time and let us use fwrite rather than fputs. The runtime on the VirtualBox stuff went down 3-4% again.

The patch won't apply without [#181] as there are a handful of affected fprintf calls near fopen and fclose.

Cheers,
knut.

P.S, I can understand it if you don't want this change as it adds a little more to pain attention to when maintaining the code.

1 Attachments

Related

Patches: #181

Discussion

  • Robert van Engelen

    This makes the code less maintainable on our side. Prefer to keep the code as it is.

     
  • Robert van Engelen

    • status: open --> closed-rejected
     

Log in to post a comment.