Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Backward compatibility with C++11 #1357

Open
sreekants opened this issue Jan 31, 2024 · 2 comments
Open

Backward compatibility with C++11 #1357

sreekants opened this issue Jan 31, 2024 · 2 comments

Comments

@sreekants
Copy link

sreekants commented Jan 31, 2024

Issue

The 'Requirements' section of the documentation says:

_Generally, fastText builds on modern Mac OS and Linux distributions. Since it uses some C++11 features, it requires a compiler with good C++11 support. These include :

(g++-4.7.2 or newer) or (clang-3.3 or newer)_

Recent performance improvements use C++17 features (specifically the use of std::string_view). Reference issue - Predict 1.9-4.2x faster (#1341)

Action

Although C++17 is now a prerequisite, fastText can still compile on C++11 with a few minor modifications, but with degraded performance. To do this:

  • Dependency on string_view is restored using a type definition on C++11.
  • Fix build errors caused by use of static_assert
  • Add instructions in the README file for modifications to makefile to build on C++11

The feature is desirable because legacy systems that use fastText (since 2015) might continue to use C++11.

Recommendation

  • Add string_view to dictionary for fast lookup (commit ffee8e4) incorrectly replaces a pass by reference by a pass by value on several constant argument. Use a pass by reference instead.
@kpu
Copy link
Contributor

kpu commented Feb 1, 2024

Can you convert this to a pull request?

* Add string_view to dictionary for fast lookup (commit [ffee8e4](https://github.com/facebookresearch/fastText/commit/ffee8e4d72a4d2ecd859575007877d12acbee5b3)) incorrectly replaces a pass by reference by a pass by value on several constant argument. Use a pass by reference instead.

https://quuxplusone.github.io/blog/2021/11/09/pass-string-view-by-value/

@sreekants
Copy link
Author

sreekants commented Feb 1, 2024 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants