Skip to content

Commit

Permalink
move remaining parts of frontend to xxhash, eliminate blake2; sketch …
Browse files Browse the repository at this point in the history
…out test program for debug string performance testing
  • Loading branch information
ryanfleury committed Jan 7, 2025
1 parent 812cea7 commit c1a2023
Show file tree
Hide file tree
Showing 30 changed files with 62 additions and 5,864 deletions.
5 changes: 3 additions & 2 deletions build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ if not "%no_meta%"=="1" (
:: --- Build Everything (@build_targets) --------------------------------------
pushd build
if "%raddbg%"=="1" set didbuild=1 && %compile% ..\src\raddbg\raddbg_main.c %compile_link% %link_icon% %out%raddbg.exe || exit /b 1
if "%radlink%"=="1" set didbuild=1 && %compile% ..\src\linker\lnk.c %compile_link% %link_natvis%"%~dp0\src\linker\linker.natvis" %out%radlink.exe || exit /b 1
if "%radlink%"=="1" set didbuild=1 && %compile% ..\src\linker\lnk.c %compile_link% %link_natvis%"%~dp0\src\linker\linker.natvis" %out%radlink.exe || exit /b 1
if "%rdi_from_pdb%"=="1" set didbuild=1 && %compile% ..\src\rdi_from_pdb\rdi_from_pdb_main.c %compile_link% %out%rdi_from_pdb.exe || exit /b 1
if "%rdi_from_dwarf%"=="1" set didbuild=1 && %compile% ..\src\rdi_from_dwarf\rdi_from_dwarf.c %compile_link% %out%rdi_from_dwarf.exe || exit /b 1
if "%rdi_dump%"=="1" set didbuild=1 && %compile% ..\src\rdi_dump\rdi_dump_main.c %compile_link% %out%rdi_dump.exe || exit /b 1
Expand All @@ -115,8 +115,9 @@ if "%tester%"=="1" set didbuild=1 && %compile% ..\src\tester
if "%ryan_scratch%"=="1" set didbuild=1 && %compile% ..\src\scratch\ryan_scratch.c %compile_link% %out%ryan_scratch.exe || exit /b 1
if "%textperf%"=="1" set didbuild=1 && %compile% ..\src\scratch\textperf.c %compile_link% %out%textperf.exe || exit /b 1
if "%convertperf%"=="1" set didbuild=1 && %compile% ..\src\scratch\convertperf.c %compile_link% %out%convertperf.exe || exit /b 1
if "%debugstringperf%"=="1" set didbuild=1 && %compile% ..\src\scratch\debugstringperf.c %compile_link% %out%debugstringperf.exe || exit /b 1
if "%parse_inline_sites%"=="1" set didbuild=1 && %compile% ..\src\scratch\parse_inline_sites.c %compile_link% %out%parse_inline_sites.exe || exit /b 1
if "%coffdump%"=="1" set didbuild=1 && %compile% ..\src\dumpers\coffdump.c %compile_link% %out%coffdump.exe || exit /b 1
if "%coffdump%"=="1" set didbuild=1 && %compile% ..\src\dumpers\coffdump.c %compile_link% %out%coffdump.exe || exit /b 1
if "%mule_main%"=="1" set didbuild=1 && del vc*.pdb mule*.pdb && %compile_release% %only_compile% ..\src\mule\mule_inline.cpp && %compile_release% %only_compile% ..\src\mule\mule_o2.cpp && %compile_debug% %EHsc% ..\src\mule\mule_main.cpp ..\src\mule\mule_c.c mule_inline.obj mule_o2.obj %compile_link% %no_aslr% %out%mule_main.exe || exit /b 1
if "%mule_module%"=="1" set didbuild=1 && %compile% ..\src\mule\mule_module.cpp %compile_link% %link_dll% %out%mule_module.dll || exit /b 1
if "%mule_hotload%"=="1" set didbuild=1 && %compile% ..\src\mule\mule_hotload_main.c %compile_link% %out%mule_hotload.exe & %compile% ..\src\mule\mule_hotload_module_main.c %compile_link% %link_dll% %out%mule_hotload_module.dll || exit /b 1
Expand Down
11 changes: 6 additions & 5 deletions src/dbg_engine/dbg_engine_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1581,10 +1581,10 @@ d_next_cmd(D_Cmd **cmd)
////////////////////////////////
//~ rjf: Main Layer Top-Level Calls

#if !defined(BLAKE2_H)
#define HAVE_SSE2
#include "third_party/blake2/blake2.h"
#include "third_party/blake2/blake2b.c"
#if !defined(XXH_IMPLEMENTATION)
# define XXH_IMPLEMENTATION
# define XXH_STATIC_LINKING_ONLY
# include "third_party/xxHash/xxhash.h"
#endif

internal void
Expand Down Expand Up @@ -1856,7 +1856,8 @@ d_tick(Arena *arena, D_TargetArray *targets, D_BreakpointArray *breakpoints, D_P

// rjf: join & hash to produce result
String8 string = str8_list_join(scratch.arena, &strings, 0);
blake2b((U8 *)&ctrl_param_state_hash.u64[0], sizeof(ctrl_param_state_hash), string.str, string.size, 0, 0);
XXH128_hash_t hash = XXH3_128bits(string.str, string.size);
MemoryCopy(&ctrl_param_state_hash, &hash, sizeof(ctrl_param_state_hash));
}

//////////////////////////////
Expand Down
11 changes: 6 additions & 5 deletions src/hash_store/hash_store.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@
////////////////////////////////
//~ rjf: Basic Helpers

#if !defined(BLAKE2_H)
#define HAVE_SSE2
#include "third_party/blake2/blake2.h"
#include "third_party/blake2/blake2b.c"
#if !defined(XXH_IMPLEMENTATION)
# define XXH_IMPLEMENTATION
# define XXH_STATIC_LINKING_ONLY
# include "third_party/xxHash/xxhash.h"
#endif

internal U128
hs_hash_from_data(String8 data)
{
U128 u128 = {0};
blake2b((U8 *)&u128.u64[0], sizeof(u128), data.str, data.size, 0, 0);
XXH128_hash_t hash = XXH3_128bits(data.str, data.size);
MemoryCopy(&u128, &hash, sizeof(u128));
return u128;
}

Expand Down
24 changes: 13 additions & 11 deletions src/raddbg/raddbg_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
//
// [ ] breakpoints in optimized code? maybe early-terminating bp resolution loop? @bpmiss
// - actually this seems to be potentially because of incomplete src-line-map info...
// [ ] Mohit-reported breakpoint not hitting - may be similar thing to @bpmiss
//
// [ ] CLI argument over-mangling?
//
// [ ] OutputDebugString spam, keeping way too much around!
// [ ] Mohit-reported breakpoint not hitting - may be similar thing to @bpmiss
//
// [ ] fix light themes
// [ ] make `array` view rule work with actual array types, to change their
Expand Down Expand Up @@ -92,14 +94,12 @@
// [ ] max view rule
// [ ] min view rule
//
// [ ] filesystem drag/drop support
// [ ] double-click vs. single-click for folder navigation, see if we can infer
// [ ] use backslashes on windows by default, forward slashes elsewhere
// [ ] use backslashes on windows by default, forward slashes elsewhere (?)
//
// [ ] investigate /DEBUG:FASTLINK - can we somehow alert that we do not
// support it?
//
// [ ] ** Converter performance & heuristics for asynchronously doing it early
//
// [ ] visualize conversion failures
//
Expand Down Expand Up @@ -174,12 +174,6 @@
// [ ] default font size is too small for me - not only source code, but
// menus/tab/watch names (which don't resize). Maybe you could query
// Windows for initial font size?
// [ ] icon fonts glyphs sometimes disappear for specific font size, but they
// reappear if you go +1 higher or -1 lower. Mostly red triangle in watch
// values for "unknown identifier". But also yellow arrow in call stack
// disappears if font size gets too large.
// [ ] undo close tab would be nice. If not for everything, then at least
// just for source files
// [ ] Jump table thunks, on code w/o /INCREMENTAL:NO

////////////////////////////////
Expand All @@ -202,6 +196,8 @@
//
// [ ] undo/redo
// [ ] proper "go back" + "go forward" history navigations
// [ ] undo close tab would be nice. If not for everything, then at least
// just for source files
//
// [ ] globally disable/configure default view rule-like things (string
// viz for u8s in particular)
Expand All @@ -219,7 +215,6 @@
// table headers, etc.)
// [ ] @cleanup straighten out index/number space & types & terminology for
// scroll lists
// [ ] @cleanup central worker thread pool - eliminate per-layer thread pools
// [ ] @cleanup eliminate explicit font parameters in the various ui paths (e.g.
// code slice params)

Expand Down Expand Up @@ -276,6 +271,13 @@
////////////////////////////////
//~ rjf: Recently Completed Task Log
//
// [x] filesystem drag/drop support
// [x] ** Converter performance & heuristics for asynchronously doing it early
// [x] icon fonts glyphs sometimes disappear for specific font size, but they
// reappear if you go +1 higher or -1 lower. Mostly red triangle in watch
// values for "unknown identifier". But also yellow arrow in call stack
// disappears if font size gets too large.
// [x] @cleanup central worker thread pool - eliminate per-layer thread pools

////////////////////////////////
//~ rjf: Build Options
Expand Down
34 changes: 34 additions & 0 deletions src/scratch/debugstringperf.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include <windows.h>

DWORD thread_entry_point(void *p)
{
for(int i = 0; i < 100000; i += 1)
{
OutputDebugString("this is a test\n");
}
return 0;
}

int main(int argc, char **argv)
{
HANDLE threads[] =
{
CreateThread(0, 0, thread_entry_point, 0, 0, 0),
CreateThread(0, 0, thread_entry_point, 0, 0, 0),
CreateThread(0, 0, thread_entry_point, 0, 0, 0),
CreateThread(0, 0, thread_entry_point, 0, 0, 0),
CreateThread(0, 0, thread_entry_point, 0, 0, 0),
CreateThread(0, 0, thread_entry_point, 0, 0, 0),
CreateThread(0, 0, thread_entry_point, 0, 0, 0),
CreateThread(0, 0, thread_entry_point, 0, 0, 0),
CreateThread(0, 0, thread_entry_point, 0, 0, 0),
CreateThread(0, 0, thread_entry_point, 0, 0, 0),
CreateThread(0, 0, thread_entry_point, 0, 0, 0),
CreateThread(0, 0, thread_entry_point, 0, 0, 0),
};
for(int i = 0; i < sizeof(threads)/sizeof(threads[0]); i += 1)
{
WaitForSingleObject(threads[i], INFINITE);
}
return 0;
}
72 changes: 0 additions & 72 deletions src/third_party/blake2/blake2-config.h

This file was deleted.

Loading

0 comments on commit c1a2023

Please sign in to comment.