remove utf8proc

This commit is contained in:
Mitchell Hashimoto
2024-02-08 21:10:37 -08:00
parent f6e694bf80
commit 4834b8e925
4 changed files with 1 additions and 41 deletions

View File

@ -1082,15 +1082,6 @@ fn addDeps(
step.linkLibrary(utfcpp_dep.artifact("utfcpp")); step.linkLibrary(utfcpp_dep.artifact("utfcpp"));
try static_libs.append(utfcpp_dep.artifact("utfcpp").getEmittedBin()); try static_libs.append(utfcpp_dep.artifact("utfcpp").getEmittedBin());
// utf8proc
const utf8proc_dep = b.dependency("utf8proc", .{
.target = target,
.optimize = optimize,
});
step.root_module.addImport("utf8proc", utf8proc_dep.module("utf8proc"));
step.linkLibrary(utf8proc_dep.artifact("utf8proc"));
try static_libs.append(utf8proc_dep.artifact("utf8proc").getEmittedBin());
// Spirv-Cross // Spirv-Cross
step.linkLibrary(spirv_cross_dep.artifact("spirv_cross")); step.linkLibrary(spirv_cross_dep.artifact("spirv_cross"));
try static_libs.append(spirv_cross_dep.artifact("spirv_cross").getEmittedBin()); try static_libs.append(spirv_cross_dep.artifact("spirv_cross").getEmittedBin());

View File

@ -38,7 +38,6 @@
.opengl = .{ .path = "./pkg/opengl" }, .opengl = .{ .path = "./pkg/opengl" },
.pixman = .{ .path = "./pkg/pixman" }, .pixman = .{ .path = "./pkg/pixman" },
.simdutf = .{ .path = "./pkg/simdutf" }, .simdutf = .{ .path = "./pkg/simdutf" },
.utf8proc = .{ .path = "./pkg/utf8proc" },
.utfcpp = .{ .path = "./pkg/utfcpp" }, .utfcpp = .{ .path = "./pkg/utfcpp" },
.zlib = .{ .path = "./pkg/zlib" }, .zlib = .{ .path = "./pkg/zlib" },

View File

@ -27,8 +27,6 @@ hyperfine \
"./zig-out/bin/bench-codepoint-width --mode=noop${ARGS} </tmp/ghostty_bench_data" \ "./zig-out/bin/bench-codepoint-width --mode=noop${ARGS} </tmp/ghostty_bench_data" \
-n wcwidth \ -n wcwidth \
"./zig-out/bin/bench-codepoint-width --mode=wcwidth${ARGS} </tmp/ghostty_bench_data" \ "./zig-out/bin/bench-codepoint-width --mode=wcwidth${ARGS} </tmp/ghostty_bench_data" \
-n utf8proc \
"./zig-out/bin/bench-codepoint-width --mode=utf8proc${ARGS} </tmp/ghostty_bench_data" \
-n table \ -n table \
"./zig-out/bin/bench-codepoint-width --mode=table${ARGS} </tmp/ghostty_bench_data" \ "./zig-out/bin/bench-codepoint-width --mode=table${ARGS} </tmp/ghostty_bench_data" \
-n simd \ -n simd \

View File

@ -46,15 +46,13 @@ const Mode = enum {
/// libc wcwidth /// libc wcwidth
wcwidth, wcwidth,
/// Use utf8proc library to calculate the display width of each codepoint.
utf8proc,
/// Use ziglyph library to calculate the display width of each codepoint. /// Use ziglyph library to calculate the display width of each codepoint.
ziglyph, ziglyph,
/// Our SIMD implementation. /// Our SIMD implementation.
simd, simd,
/// Test our lookup table implementation.
table, table,
}; };
@ -82,7 +80,6 @@ pub fn main() !void {
switch (args.mode) { switch (args.mode) {
.noop => try benchNoop(reader, buf), .noop => try benchNoop(reader, buf),
.wcwidth => try benchWcwidth(reader, buf), .wcwidth => try benchWcwidth(reader, buf),
.utf8proc => try benchUtf8proc(reader, buf),
.ziglyph => try benchZiglyph(reader, buf), .ziglyph => try benchZiglyph(reader, buf),
.simd => try benchSimd(reader, buf), .simd => try benchSimd(reader, buf),
.table => try benchTable(reader, buf), .table => try benchTable(reader, buf),
@ -132,31 +129,6 @@ noinline fn benchWcwidth(
} }
} }
noinline fn benchUtf8proc(
reader: anytype,
buf: []u8,
) !void {
const utf8proc = @import("utf8proc");
var d: UTF8Decoder = .{};
while (true) {
const n = try reader.read(buf);
if (n == 0) break;
// Using stream.next directly with a for loop applies a naive
// scalar approach.
for (buf[0..n]) |c| {
const cp_, const consumed = d.next(c);
assert(consumed);
if (cp_) |cp| {
const width = utf8proc.charwidth(cp);
// Write the width to the buffer to avoid it being compiled away
buf[0] = @intCast(width);
}
}
}
}
noinline fn benchTable( noinline fn benchTable(
reader: anytype, reader: anytype,
buf: []u8, buf: []u8,