diff --git a/scripts/dev/detect-native.go b/scripts/dev/detect-native.go index 5c3e9da..69f9413 100644 --- a/scripts/dev/detect-native.go +++ b/scripts/dev/detect-native.go @@ -18,6 +18,22 @@ func main() { // Check for native libraries checkNativeLibs() + + // Show native comparison if available + _, cppErr := os.Stat("native_cpp_benchmark_results.txt") + _, rustErr := os.Stat("native_rust_benchmark_results.txt") + + if cppErr == nil { + fmt.Println() + fmt.Println("C++ native library benchmarks available at: native_cpp_benchmark_results.txt") + } + if rustErr == nil { + fmt.Println("Rust native library benchmarks available at: native_rust_benchmark_results.txt") + } + if cppErr == nil || rustErr == nil { + fmt.Println("To compare Go vs Native:") + fmt.Println(" make benchmark-compare") + } } func cgoEnabled() bool { @@ -31,8 +47,8 @@ func cgoEnabled() bool { } func checkNativeLibs() { - // Check for native library files - libPaths := []string{ + // Check for C++ native library files + cppLibPaths := []string{ "native/build/libdataset_hash.so", "native/build/libdataset_hash.dylib", "native/build/libdataset_hash.dll", @@ -41,20 +57,49 @@ func checkNativeLibs() { "native/build/libstreaming_io.so", } - found := false - for _, path := range libPaths { + // Check for Rust native library files + rustLibPaths := []string{ + "native_rust/target/release/libdataset_hash.so", + "native_rust/target/release/libdataset_hash.dylib", + "native_rust/target/release/libdataset_hash.dll", + "native_rust/target/release/libqueue_index.so", + "native_rust/target/release/libqueue_index.dylib", + "native_rust/target/release/libqueue_index.dll", + } + + foundCpp := false + foundRust := false + + fmt.Println("=== C++ Native Libraries ===") + for _, path := range cppLibPaths { if _, err := os.Stat(path); err == nil { fmt.Printf("Found: %s\n", path) - found = true + foundCpp = true } } - if !found { - fmt.Println("✗ No native libraries found in native/build/") + if !foundCpp { + fmt.Println("✗ No C++ native libraries found") + } + + fmt.Println() + fmt.Println("=== Rust Native Libraries ===") + for _, path := range rustLibPaths { + if _, err := os.Stat(path); err == nil { + fmt.Printf("Found: %s\n", path) + foundRust = true + } + } + + if !foundRust { + fmt.Println("✗ No Rust native libraries found") + } + + if !foundCpp && !foundRust { fmt.Println() fmt.Println("To use native libraries:") - fmt.Println(" 1. Build native libs: cd native && mkdir -p build && cd build && cmake .. && make") - fmt.Println(" 2. Build Go with native: go build -tags native_libs ./...") + fmt.Println(" C++: make native-build") + fmt.Println(" Rust: make rust-build") fmt.Println() fmt.Println("Current implementation: Go standard library") }