fceruti

fceruti

Hey everyone!

For a personal project I’m working, I need to use boxicons in surface templates. Since the package didn’t exist, I decided to take the matter into my own hands. The results are here:

https://github.com/fceruti/surface-boxicon

I feel like a leveled up or something.

PS: The library is very small, so I’d very happy if you could check it out and point out things you would have don’t better. Anything. Even style pointers are most welcomed.

Showing Posts 1 to 10

aziz

aziz

Very nice and congrats! Just a small thing but it sticks out immediately: could you give the background of the search area a softer white/grey colour so the contrast isn’t as overwhelming? :+1:

fceruti

fceruti OP

I’m sorry, I’m not following you. What search area are you talking about?

aziz

aziz

Sorry, I thought you were also behind the boxicons.com page. I meant the search area on that page.

msaraiva

msaraiva

Broadway Core Team

Hi @fceruti. Nice work!

One thing to keep in mind is that defining modules is more expensive than defining multiple function clauses so since all components have the same props, I believe you would have a more consistent API, along with faster compilation, if you define a single component with name and maybe also a type prop to differentiate each icon. Something like:

def render(%{name: "video-plus", type="solid"} = assigns) do
  ~F[<svg ... width={@size} height={@size} class={@class} .../></svg>]
end

def render(%{name: "video-plus", type="regular"} = assigns) do
  ~F[<svg ... width={@size} height={@size} class={@class} .../></svg>]
end

def render(%{name: "bell", type="solid"} = assigns) do
  ~F[<svg ... width={@size} height={@size} class={@class} .../></svg>]
end

def render(%{name: "bell", type="regular"} = assigns) do
  ~F[<svg ... width={@size} height={@size} class={@class} .../></svg>]
end
...

Then you could use it like:

<BoxIcon name="bell" type="solid"/>
fceruti

fceruti OP

That’s great! Actually compilation time was something bothering me. Thanks!

fceruti

fceruti OP

Turns out, with this approach, compilation times went bananas! I’m compiling that single module in about 60 seconds, while it used to take around 10-15 seconds to compile all the 1500 modules.

I do appreciate how the API is much better now thou.

Anyone got any ideas on how to improve things? The file in question is this: surface-boxicon/lib/boxicon.ex at main · fceruti/surface-boxicon · GitHub

kip

kip

ex_cldr Core Team

Large numbers of function clauses does eventually create exponentially slower compilation times. I have a similar issue in ex_CLDR and I know the gettext team went with splitting into modules as an option for the same reason.

I haven’t dug far enough to know where performance gets pathologically bad but ‘hundreds’ of clauses seems to exhibit this behaviour.

derek-zhou

derek-zhou

Is it because the 1500 modules are compiled in parallel, whereas the one giant module can only be compiled in one thread?
Can you compare the CPU time. I am curious whether too many function clauses have non linear performance penalty, on top of the lack of parallelization?

fceruti

fceruti OP

I’m not sure, but it makes perfect sense, since I saw a ~6X increase in time and I’m running on a 6 core machine.

How can I get the CPU time used in compilation?

derek-zhou

derek-zhou

use time(1). such as:

derek@roastidious:~/projects/roastidious$ time mix compile
Compiling 39 files (.ex)
Generated roastidious app

real	0m2.150s
user	0m3.608s
sys	0m1.017s

real is the wall time, user+sys is the cpu time spent; please note cpu time is usually larger than wall time.

Where Next? Top

Trending in Announcing Top

woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New
MRdotB
I needed to reuse React components from my Chrome extension in my Phoenix/LiveView backend. I noticed that for Svelte/Vue, there are live...
New
woylie
I released Doggo, a collection of unstyled Phoenix components. https://github.com/woylie/doggo Features Unstyled Phoenix components....
New
GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
ahamez
Hi everyone, I’ve been working on this protobuf library for 3 years. We use it in the company I work for, EasyMile, to communicate with ...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
bartblast
Hey folks, I just published a post about Hologram’s funding and where the project goes next - the short version: Curiosum as Main Spons...
New
CodeSync
:microphone: ElixirConf 2026 - Call for Talks is open! We’re heading to Chicago :united_states: :round_pushpin: In person + virtual :d...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews