From 283152a880a96b3c668d950dd86ebe7db443ed88 Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Fri, 14 Nov 2014 09:45:49 -0700 Subject: [PATCH] Speed up print functions --- include/chaiscript/dispatchkit/bootstrap.hpp | 4 ++-- samples/fun_call_performance.chai | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/chaiscript/dispatchkit/bootstrap.hpp b/include/chaiscript/dispatchkit/bootstrap.hpp index 7889ec1..3e88daf 100644 --- a/include/chaiscript/dispatchkit/bootstrap.hpp +++ b/include/chaiscript/dispatchkit/bootstrap.hpp @@ -202,12 +202,12 @@ namespace chaiscript static void print(const std::string &s) { - std::cout << s; + fwrite(s.c_str(), 1, s.size(), stdout); } static void println(const std::string &s) { - std::cout << s << '\n'; + puts(s.c_str()); } diff --git a/samples/fun_call_performance.chai b/samples/fun_call_performance.chai index 78ef577..65c0120 100644 --- a/samples/fun_call_performance.chai +++ b/samples/fun_call_performance.chai @@ -1,4 +1,4 @@ -for (var i = 0; i < 100000; ++i) { - print(helloWorld("Bob12345")) +for (var i = 0; i < 1000; ++i) { + puts(helloWorld("Bob12345")) }