Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace std::iostream use with stdio in FastPFor lib #96

Merged
merged 3 commits into from
Dec 24, 2022

Conversation

pps83
Copy link
Contributor

@pps83 pps83 commented Dec 24, 2022

Fix missing std:: when STATS enabled is a simple fix.

Replace std::iostream use with stdio in FastPFor lib - is a good change imo, but it may have issues.
All uses of std::cout/cerr were replaced with printf, and even if the changes didn't introduce errors (please double check), there might be issues with printf modifiers with old compilers. For example, %zu is available starting from VS2013. In any case, that's a 10-year old version of VS

Compilation would fail if STATS is enabled in util.h
@pps83 pps83 changed the title Fix missing std:: when STATS enabled Replace std::iostream use with stdio in FastPFor lib Dec 24, 2022
@pps83 pps83 force-pushed the master-msvc-fixes branch from 68a5bfa to 56c8bec Compare December 24, 2022 14:15
 + remove unused printme
 + change ASSERT macro to take message as an std::string

Even basic use of iostream pulls in dependencies that are almost as big in code size as the rest of the FastPFor library itself. Consider the following simple example that pulls in all codecs from codecfactory compiled with static runtime with VS2022:

```
#include "codecfactory.h"

int main()
{
    for (auto codec : FastPForLib::CODECFactory().allSchemes())
    {
        size_t z;
        codec->encodeArray((uint32_t*)0, 0, 0, z);
        codec->decodeArray(0, 0, (uint32_t*)0, z);
    }
}
```

When using std::iostream resulting binary is 834KB. When using stdio resulting binary is 571KB.
@pps83 pps83 force-pushed the master-msvc-fixes branch from 56c8bec to 71b0425 Compare December 24, 2022 14:18
@lemire
Copy link
Member

lemire commented Dec 24, 2022

Looks fine. Merging.

@lemire lemire merged commit 8559fe8 into fast-pack:master Dec 24, 2022
@pps83 pps83 deleted the master-msvc-fixes branch December 24, 2022 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants