Skip to content

Various micro perf fixes and cleanup found while implementing CN overrides so far#818

Merged
ras0219-msft merged 16 commits intomicrosoft:masterfrom
BillyONeal:perf_fixes
Aug 3, 2018
Merged

Various micro perf fixes and cleanup found while implementing CN overrides so far#818
ras0219-msft merged 16 commits intomicrosoft:masterfrom
BillyONeal:perf_fixes

Conversation

@BillyONeal
Copy link
Copy Markdown
Member

No description provided.

lock_guard<mutex> lock(m_action_lock);
//std::cout << "on_open" << std::endl;
m_actions.push(action(SUBSCRIBE,hdl));
lock.unlock();
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Hmmm apparently this isn't built?

typedef char char_t;
typedef std::string string_t;
#define _XPLATSTR(x) x
#define _XPLATTOSTR(x) std::to_string(x)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Perhaps it makes more sense to define a template<class T> string_t to_string_t(T&&)?


using websocketpp::lib::thread;
using websocketpp::lib::mutex;
using websocketpp::lib::lock_guard;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is part of the vendored copy of websocketpp, so we should avoid modifying it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I see, I'll revert changes in this example.

#endif

#define CRLF std::string("\r\n")
const std::string CRLF("\r\n");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should probably be static or moved into a details namespace to avoid conflicting symbols if the user static links.

request_stream << "CONNECT " << host << ":" << ((port != 0) ? port : 443) << " HTTP/1.1" << CRLF;
request_stream << "Host: " << host << ":" << ((port != 0) ? port : 443) << CRLF;
request_stream << "Proxy-Connection: Keep-Alive" << CRLF;
request_stream << "CONNECT " << host << ":" << port << " HTTP/1.1\r\n";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

May I ask what is the reason for using both CRLF and hardcoded "\r\n" in this code snippet?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

When CRLF was the entire constant, I left it alone; worst case it saves a strlen on the crlf. Where CRLF was causing an additional trip through <<, I removed it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I understand, thx for reply.

# Conflicts:
#	Release/src/http/client/http_client_asio.cpp
# Conflicts:
#	Release/src/http/client/http_client_asio.cpp
#	Release/src/http/client/http_client_winrt.cpp
@ras0219-msft ras0219-msft merged commit 14adc2e into microsoft:master Aug 3, 2018
@ras0219-msft
Copy link
Copy Markdown
Contributor

@BillyONeal Thanks!

@garethsb-sony thanks for also reviewing :)

@BillyONeal BillyONeal deleted the perf_fixes branch August 3, 2018 23:46
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.

4 participants