Search code examples
.netnhibernateormcomparisonlightspeed

Lightspeed vs NHibernate


What is the experience with LightSpeed? The comparison provided by Mindscape doesn't say too much about NHibernate. Lightspeed seems flexible, but I don't see much about performance. How well does Lightspeed perform? Also are there any drawbacks to using Lightspeed?


Solution

  • Over the past six months, I've been using NHibernate with Active Record at work, and LightSpeed at home in my spare time.

    Advantages / Drawbacks So far, I've found both LightSpeed and NHibernate with Active Record to be straightforward to learn.

    I haven't found drawbacks with LightSpeed (yet). The features I like most are:

    • Convention over configuration. This saves a lot of time and provides consistent code.
    • The model class and config generator.
    • Support for Linq and MySQL 5.

    The features I like most about Active Record are:

    • No XML configuration required, the most common configuration options are provided automatically.
    • NHibernate's flexibility is still available when required (e.g. criteria queries).

    The drawbacks of Active Record for me are:

    • There appear to be more Ruby on Rails code examples than C# examples

    Performance I haven't (yet) compared both products side by side and run performance tests on both equally.

    I would guess that NHibernate suffers from a deeper class hierarchy. While optimising my code using ANTS Profiler, I found that for a simple query there is call after call through NHibernate classes before the actual SQL query is produced.

    Of course, it's the query that is produced that will make all the difference to the ultimate performance of the ORM.

    Both LightSpeed and NHibernate offer lazy loading, and Active Record makes this easy for NHibernate.

    I think it is easier to optimise your queries using Lightspeed with Linq, and more clear to people maintaining your code. Whereas it's not usually recommended to write NHibernate HQL.