sharplispers/split-sequence — pull request #2 by attila-lendvai (2014-01-24 07:07:51+00:00)
Title: Optimizations

without inlining these changes yield only about 3-4% speedup on sbcl, using the following form.

```
(let ((value "cusfFhrjlEafQnkZhRzqSYZccNxuHptrIMPAFMtmbGCNuuyLSnZCwwCkkJZJahHzuBIUomDrMSJOILqzYHowZRqzsnQFzQWhUIoDSjFjjJnBWPhqubKCEtmqKkvKDaVnchqKdFfnzXPfKWozCxQAEBjTfdeQeCwmBLwkZiOZjXHNWtIVwfhIChECIXktdzPcyCosCnGoJwEgdASIoqztsLIxkXwxokLeHbbBgrIdNsOwIUNwczOEQUpUkECVgDbtxXhxDwxUVpEgMhnhkcAcichBrSfUjDnLqbmQxNTRRyrhzNJzjMWMkbgEltNPCHvIotNiwXOZaLSiHejwQlXTPQDpOvtChVbJgQsRYdXJQNLWOGEZSCvPTodrvUglpYAtCkZuriUIkgiRXNsBXkuYegBOpputfJuIujIvnmblnPndQjMwipqrjrOdPaxXhhOodlWBBmnCQATNqYlfooinKtzSupIdaxYuzxrrzyIzYfeEMgRboIDRVaLvmNTDdbTY"))
(sb-ext:gc)
(time (loop repeat 300000
do (split-sequence:split-sequence #\x value)))
(values))
```

but when inlining is enabled, then it becomes some 4 times faster with these patches:

```
(funcall (compile
nil
(lambda ()
(declare (inline split-sequence:split-sequence))
(let ((value "cusfFhrjlEafQnkZhRzqSYZccNxuHptrIMPAFMtmbGCNuuyLSnZCwwCkkJZJahHzuBIUomDrMSJOILqzYHowZRqzsnQFzQWhUIoDSjFjjJnBWPhqubKCEtmqKkvKDaVnchqKdFfnzXPfKWozCxQAEBjTfdeQeCwmBLwkZiOZjXHNWtIVwfhIChECIXktdzPcyCosCnGoJwEgdASIoqztsLIxkXwxokLeHbbBgrIdNsOwIUNwczOEQUpUkECVgDbtxXhxDwxUVpEgMhnhkcAcichBrSfUjDnLqbmQxNTRRyrhzNJzjMWMkbgEltNPCHvIotNiwXOZaLSiHejwQlXTPQDpOvtChVbJgQsRYdXJQNLWOGEZSCvPTodrvUglpYAtCkZuriUIkgiRXNsBXkuYegBOpputfJuIujIvnmblnPndQjMwipqrjrOdPaxXhhOodlWBBmnCQATNqYlfooinKtzSupIdaxYuzxrrzyIzYfeEMgRboIDRVaLvmNTDdbTY"))
(sb-ext:gc)
(time (loop repeat 300000
do (split-sequence:split-sequence #\x value)))
(values)))))
```

maybe some of that could be gained also by adding some clever type dispatch inside split-sequence ala sb-impl::string-dispatch? a hasty and sloppy check didn't yield anything interesting for me.