Skip to content
A fast IRC parsing library for crystal.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Travis CI

An optimised IRC parsing library for crystal. Supports IRCv3 message tags. Getting started is as easy as FastIRC.parse(io) do |message|.

Fast_irc doesn't attempt to deal with the semantics of IRC messages. Messages are simply parsed into a machine-readable format and delivered to the user.


Here fast_irc was tested parsing a 63748 byte IRC log file collected from real IRC activity on the IRC network. Fast_irc's performance on a single core averaged over 150MB/s, taking only 740 nanoseconds to parse a single line.

In terms of memory performance, a single 8192 byte buffer is allocated per connection. All string values in the IRC prefix, the IRC command, and IRCv3 tag keys are interned in a global string pool to save memory. IRCv3 message tag values and IRC command parameters are not interned.


Add it to shard.yml

    github: RX14/
    version: 0.3.3


Build the documentation by cloning this repo and running crystal doc. HTML documentation will be placed in doc/.


It's easy to get started parsing IRC connections right away using fast_irc. Just pass an IO (likely a TCP connection to an IRC server) to FastIRC.parse. Message objects are yielded as they arrive on the connection. For a non-block way to read messages, see FastIRC::Reader.

FastIRC.parse(io) do |message|
  message.command       # => "PRIVMSG" : String
  message.params        # => ["#crystal-lang", "Test message using!"] : Array(String)?
  message.prefix.source # => "RX14" : String

Generating IRC is just as easy. Create your Message object and call to_s."PRIVMSG", ["#WAMM", "test message"]).to_s(io)

You can also add IRCv3 tags and a prefix. FastIRC::Tags is simply an alias for Hash(String, String?). It is recommended to use the FastIRC::Tags alias when creating tags hashes both to clear intent, and to make sure that you don't end up with a Hash(String, String) instead, which is a binary-incompatible type.

prefix = "RX14", user: "rx14", host: "")
tags = FastIRC::Tags{"time" => "2016-11-11T22:27:15Z"}"PRIVMSG", ["#WAMM", "test message"], prefix: prefix, tags: tags).to_s(io)


  1. Fork it ( )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request


  • RX14 Chris Hobbs - creator, maintainer
  • Kilobyte22 Stephan Henrichs - IRC serialisation, specs
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.