Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Avoid using <locale> and <iostream> #13135

Merged
merged 12 commits into from
Oct 23, 2018
Merged

Avoid using <locale> and <iostream> #13135

merged 12 commits into from
Oct 23, 2018

Conversation

kkaefer
Copy link
Contributor

@kkaefer kkaefer commented Oct 18, 2018

Some of our uses of <locale> increase binary size quite a bit. This removes most uses of <locale>. Additionally, <iostream> in combination with <iomanip> significantly increases the binary size as well. Instead, we're now always using RapidJSON's floating point stringification algorithm.

Copy link
Contributor

@pozdnyakov pozdnyakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! LGTM % nits

bin/offline.cpp Show resolved Hide resolved
result += *cacheDir;
result += "/com.mapbox.gl.shader.";
result += name;
result += ".";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit result += '.'; // as a symbol

result.reserve(32);
result += "#define DEVICE_PIXEL_RATIO ";
result += util::toString(pixelRatio, true);
result += "\n";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: result += '\n';

ss << "v2";
return ss.str();
std::string result;
result.reserve(sizeof(size_t) * 2 * 2 + 2 + 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a comment explaining sizeof(size_t) * 2 * 2 + 2 + 1 would be great

namespace util {

template <class T>
inline void hash_combine(std::size_t& seed, const T& v) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

think inline is not needed for a template function

}

template <class... Args>
inline std::size_t hash(Args&&... args) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto


template <class... Args>
inline std::size_t hash(Args&&... args) {
std::size_t seed = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: = 0u;

@friedbunny friedbunny added refactor Core The cross-platform C++ core, aka mbgl labels Oct 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Core The cross-platform C++ core, aka mbgl refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants