Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
libhxcpp 6.0.0 (unreleased)
------------------------------------------------------------

* Added HXCPP_PROGRESS_PERCENT, which shows a group's compile progress as a percentage of its files, [42.5% ], instead of a count, [425/1000]
* Fixed a program on Linux with glibc staying as large as its largest burst of large allocations, such as the files a game reads while it loads: glibc keeps a freed buffer's memory in its heap unless it had mapped the buffer on its own, and once a buffer mapped on its own has been freed it stops mapping those of that size or less, up to 32 MB. The memory of the large buffers a collection freed then stayed the process's. The collector now trims the C heap once 16 MB has been freed to it, on the thread that frees the buffers. A program that dropped 384 MB of 4 MB buffers stayed at 396 MB resident and now returns to 12 MB
* Fixed a native extension that includes hx/CFFI.h before hx/CFFIPrime.h, as SteamWrap does, failing to compile with hxs_encoding, hxs_utf16 and alloc_hxs_utf8 not declared: CFFI.h included first declares the CFFI API without HXCPP_PRIME, so without the Prime string functions that the ordinary wrapper of a DEFINE_PRIME function now uses. CFFIPrime.h declares them then
* Made the collector's thread context on Linux a __thread pointer, read with one load from the thread pointer, instead of a call to pthread_getspecific each time an allocation leaves the inline path or a String or number is boxed. It was 3 to 4% of an OpenFL game's main thread. HXCPP_PTHREAD_FAST_TLS keeps pthread_getspecific (libhxcpp #429)
Expand Down
1 change: 1 addition & 0 deletions docs/build_xml/Defines.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ Other defines:
| *HXCPP_QUIET* | Print less output from the build tool |
| *HXCPP_SILENT* | Print only errors from the build tool |
| *HXCPP_COMPILE_THREADS* | Number of files to compile at once (also read from the environment) |
| *HXCPP_PROGRESS_PERCENT* | Show a group's progress as a percentage of its files, instead of a count |
| *HXCPP_COMPILE_CACHE* | Directory for the compile cache, usually set in the environment. See [CompileCache.md](../CompileCache.md) |
| *HXCPP_TIMES* | Show some basic profiling information |
| *HXCPP_NEKO_BUILDTOOL* | Force use of hxcpp.n, rather than compiled BuildTool.exe
Expand Down
2 changes: 1 addition & 1 deletion tools/hxcpp/BuildTool.hx
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ class BuildTool
} : null;

Profile.push("compile");
var progress = new Progress(to_be_compiled.length);
var progress = new Progress(to_be_compiled.length, mDefines.exists("HXCPP_PROGRESS_PERCENT"));
if (threadPool==null)
{
for(file in to_be_compiled)
Expand Down
16 changes: 14 additions & 2 deletions tools/hxcpp/Progress.hx
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
// How many of a group's files have compiled, shown before each file as it starts
// How many of a group's files have compiled, shown before each file as it
// starts: a count, or with HXCPP_PROGRESS_PERCENT a percentage
class Progress
{
var finished:Int;
var total:Int;
var percent:Bool;

public function new(inTotal:Int)
public function new(inTotal:Int, inPercent = false)
{
finished = 0;
total = inTotal;
percent = inPercent;
}

public function label():String
{
if (percent)
{
// Pad to the width of 100.0% so the file names line up
var tenths = total > 0 ? Std.int(finished * 1000 / total) : 1000;
var done = Std.int(tenths / 10) + "." + (tenths % 10) + "%";
while (done.length < 6)
done = done + " ";
return "\x1b[1m[" + done + "]\x1b[0m";
}
var done = Std.string(finished);
while (done.length < Std.string(total).length)
done = " " + done;
Expand Down