So I took @warrenm's MetalSlug (https://github.com/metal-by-example/MetalSlug) - itself an implementation of the https://sluglibrary.com paper…

Ported it to https://metalsprockets.com

Optimised it so it renders all text in a single draw call (from an original 40,000 draw calls…)

And then entered the matrix?

Every glyph is vector. Whoa.

(Code needs a cleanup - it got messy but will put it online soon)

A completely vector based terminal view eh @Migueldeicaza? Or did the work you do recently use SLUG?
@schwa wow, my thing uses rasterized bitmaps and the atlas. This is so cool
@Migueldeicaza Not at all optimised - but concept works. 40fps on a M5 Max isn't great.
@schwa omg this is sublime. I love this

@Migueldeicaza Ok - 60fps, should easily manage 120fps when I am not plugged into that speed bump of a Apple Studio Display.

(Big difference running release vs debug - those Swift arrays are slooow. And a couple of obvious optimisations).

Not sure if SwiftTerm needs this but can look into contributing.

@schwa @Migueldeicaza have you all tried any of the noncopyable containers we've been working on in https://github.com/apple/swift-collections?tab=readme-ov-file#basiccontainers-module for your hot paths
GitHub - apple/swift-collections: Commonly used data structures for Swift

Commonly used data structures for Swift. Contribute to apple/swift-collections development by creating an account on GitHub.

GitHub
@joe @schwa oh I had not! I need to pay more attention, which ones there?
@joe @schwa oh RigidArray! Will check it out! That’s exactly what I need
@Migueldeicaza @schwa `UniqueArray` (which grows dynamically but has unique ownership) and `RigidArray` (which grows only up to a prespecified capacity limit) would be the closest to drop-in-replacement for existing `Array` usage
@joe @Migueldeicaza In my case I don't think the speed boosts are warranted the work. But I'll be reaching for them for another couple of projects that will benefit.
@schwa @Migueldeicaza another possibly less-disruptive thing you might experiment with when you have the chance is adopting `Span`/`MutableSpan` in places where you're only reading or writing an array's elements in-place

@joe @Migueldeicaza Yeah i'm using (mutable)span in a few places.

I do have a great issue around perf of simd_float4x4 in the (original) unsafebufferpointer. Writing the matrices the proper way (building up the matrix) was ~4fps… doing it just by writing directly to the members… full speed.

I was blaming array when really it was simd.

I'll see if i can reproduce again and understand it rationally (likely safe vs non safe access). Was fun.

@joe @schwa @Migueldeicaza +1! Noncopyable types are how I've been shipping Swift rewrites that are faster than C
@joe @schwa @Migueldeicaza There’s a reason I manually ported my sample from Swift to Obj-C. Debug performance is absolutely atrocious, and these marginal hacks call into question whether ordinary Swift developers can write idiomatic, performant code. I don’t doubt that performance weenies can write code that’s “faster than C”—now solve it for everyone else.
@warrenm @joe @schwa I am just at the stage in life where I rather spend time with the profiler and picking these idioms than spending days staring a core dumps :-)

@schwa this would be very neat!

Yeah swift arrays are bad, dynamic exclusive access is still my main problem