You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by "Jo Inge Arnes (JIRA)" <ji...@apache.org> on 2006/07/01 03:43:29 UTC

[jira] Created: (LUCENENET-8) Throwing an exception as a result of a normal situation is extremely bad in .net

Throwing an exception as a result of a normal situation is extremely bad in .net
--------------------------------------------------------------------------------

         Key: LUCENENET-8
         URL: http://issues.apache.org/jira/browse/LUCENENET-8
     Project: Lucene.Net
        Type: Task

 Environment: Windows XP, Visual Studio 2003
    Reporter: Jo Inge Arnes


At the end of the FastCharStream.Refill() method, it says:

int charsRead = input.Read(buffer, newPosition, buffer.Length - newPosition);
if (charsRead <= 0)
   throw new System.IO.IOException("read past eof");
else
   bufferLength += charsRead;

When I run Lucene in the debugger, this causes an exception to be thrown all the time.
To me it looks like it is thrown as a result of a normal situation, not because of some critical error.

Is this correct?

If this is the case, then the code is horrible. Throwing an exception in .NET is extremely slow, and should never be thrown as a result of a normal situation. I repeat: "extremely slow"

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Re: [jira] Created: (LUCENENET-8) Throwing an exception as a result of a normal situation is extremely bad in .net

Posted by jxf jxf <dj...@gmail.com>.
i think it can :
int charsRead = input.Read(buffer, newPosition, buffer.Length -
newPosition);
if (charsRead > 0)
  bufferLength += charsRead;



2006/7/1, Jo Inge Arnes (JIRA) <ji...@apache.org>:
>
> Throwing an exception as a result of a normal situation is extremely bad
> in .net
>
> --------------------------------------------------------------------------------
>
>         Key: LUCENENET-8
>         URL: http://issues.apache.org/jira/browse/LUCENENET-8
>     Project: Lucene.Net
>        Type: Task
>
> Environment: Windows XP, Visual Studio 2003
>    Reporter: Jo Inge Arnes
>
>
> At the end of the FastCharStream.Refill() method, it says:
>
> int charsRead = input.Read(buffer, newPosition, buffer.Length -
> newPosition);
> if (charsRead <= 0)
>   throw new System.IO.IOException("read past eof");
> else
>   bufferLength += charsRead;
>
> When I run Lucene in the debugger, this causes an exception to be thrown
> all the time.
> To me it looks like it is thrown as a result of a normal situation, not
> because of some critical error.
>
> Is this correct?
>
> If this is the case, then the code is horrible. Throwing an exception in
> .NET is extremely slow, and should never be thrown as a result of a normal
> situation. I repeat: "extremely slow"
>
> --
> This message is automatically generated by JIRA.
> -
> If you think it was sent incorrectly contact one of the administrators:
>   http://issues.apache.org/jira/secure/Administrators.jspa
> -
> For more information on JIRA, see:
>   http://www.atlassian.com/software/jira
>
>

Re: [jira] Closed: (LUCENENET-8) Throwing an exception as a result of a normal situation is extremely bad in .net

Posted by Ben Martz <be...@gmail.com>.
Is there an "official" place to store up-to-date patch files to resolve
these exceptions (is the issues archive really the right place)? I
completely understand that the changes are outside the scope of this project
since they change the fundamental operation of certain methods but resolving
the exceptions is mandatory if Lucene.Net is to be deployed in a production
environment. I also understand that, were I a new user, I _could_ search
through the issues archive to find old patch files that I could adapt but it
would be nice to have a page or something that formally addresses this issue
and provides up-to-date patch files to resolve the issue. This is not a
complaint mind you, but perhaps just food for thought.

Cheers,
Ben

On Fri, Nov 14, 2008 at 5:28 PM, Digy (JIRA) <ji...@apache.org> wrote:

>
>     [
> https://issues.apache.org/jira/browse/LUCENENET-8?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel]
>
> Digy closed LUCENENET-8.
> ------------------------
>
>    Resolution: Invalid
>      Assignee: Digy
>
> I think, after 2 year,  this issue is invalid and can be closed.
>
>
> > Throwing an exception as a result of a normal situation is extremely bad
> in .net
> >
> --------------------------------------------------------------------------------
> >
> >                 Key: LUCENENET-8
> >                 URL: https://issues.apache.org/jira/browse/LUCENENET-8
> >             Project: Lucene.Net
> >          Issue Type: Task
> >         Environment: Windows XP, Visual Studio 2003
> >            Reporter: Jo Inge Arnes
> >            Assignee: Digy
> >         Attachments: test.patch
> >
> >
> > At the end of the FastCharStream.Refill() method, it says:
> > int charsRead = input.Read(buffer, newPosition, buffer.Length -
> newPosition);
> > if (charsRead <= 0)
> >    throw new System.IO.IOException("read past eof");
> > else
> >    bufferLength += charsRead;
> > When I run Lucene in the debugger, this causes an exception to be thrown
> all the time.
> > To me it looks like it is thrown as a result of a normal situation, not
> because of some critical error.
> > Is this correct?
> > If this is the case, then the code is horrible. Throwing an exception in
> .NET is extremely slow, and should never be thrown as a result of a normal
> situation. I repeat: "extremely slow"
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>


-- 
13:37 - Someone stole the precinct toilet. The cops have nothing to go on.
14:37 - Officers dispatched to a daycare where a three-year-old was
resisting a rest.
21:11 - Hole found in nudist camp wall. Officers are looking into it.

[jira] Commented: (LUCENENET-8) Throwing an exception as a result of a normal situation is extremely bad in .net

Posted by "George Aroush (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/LUCENENET-8?page=comments#action_12442436 ] 
            
George Aroush commented on LUCENENET-8:
---------------------------------------

Hi Marco,

Skipping 2.0 release is not a good option.  In order for us to have 2.0.1 release we need a stable 2.0 release.  Once we have that, we can accumulate the changes from 2.0.1 onto it.

Regards,

-- George Aroush

> Throwing an exception as a result of a normal situation is extremely bad in .net
> --------------------------------------------------------------------------------
>
>                 Key: LUCENENET-8
>                 URL: http://issues.apache.org/jira/browse/LUCENENET-8
>             Project: Lucene.Net
>          Issue Type: Task
>         Environment: Windows XP, Visual Studio 2003
>            Reporter: Jo Inge Arnes
>         Assigned To: George Aroush
>         Attachments: test.patch
>
>
> At the end of the FastCharStream.Refill() method, it says:
> int charsRead = input.Read(buffer, newPosition, buffer.Length - newPosition);
> if (charsRead <= 0)
>    throw new System.IO.IOException("read past eof");
> else
>    bufferLength += charsRead;
> When I run Lucene in the debugger, this causes an exception to be thrown all the time.
> To me it looks like it is thrown as a result of a normal situation, not because of some critical error.
> Is this correct?
> If this is the case, then the code is horrible. Throwing an exception in .NET is extremely slow, and should never be thrown as a result of a normal situation. I repeat: "extremely slow"

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Assigned: (LUCENENET-8) Throwing an exception as a result of a normal situation is extremely bad in .net

Posted by "George Aroush (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENENET-8?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

George Aroush reassigned LUCENENET-8:
-------------------------------------

    Assignee:     (was: George Aroush)

> Throwing an exception as a result of a normal situation is extremely bad in .net
> --------------------------------------------------------------------------------
>
>                 Key: LUCENENET-8
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-8
>             Project: Lucene.Net
>          Issue Type: Task
>         Environment: Windows XP, Visual Studio 2003
>            Reporter: Jo Inge Arnes
>         Attachments: test.patch
>
>
> At the end of the FastCharStream.Refill() method, it says:
> int charsRead = input.Read(buffer, newPosition, buffer.Length - newPosition);
> if (charsRead <= 0)
>    throw new System.IO.IOException("read past eof");
> else
>    bufferLength += charsRead;
> When I run Lucene in the debugger, this causes an exception to be thrown all the time.
> To me it looks like it is thrown as a result of a normal situation, not because of some critical error.
> Is this correct?
> If this is the case, then the code is horrible. Throwing an exception in .NET is extremely slow, and should never be thrown as a result of a normal situation. I repeat: "extremely slow"

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (LUCENENET-8) Throwing an exception as a result of a normal situation is extremely bad in .net

Posted by "Digy (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENENET-8?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Digy closed LUCENENET-8.
------------------------

    Resolution: Invalid
      Assignee: Digy

I think, after 2 year,  this issue is invalid and can be closed. 


> Throwing an exception as a result of a normal situation is extremely bad in .net
> --------------------------------------------------------------------------------
>
>                 Key: LUCENENET-8
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-8
>             Project: Lucene.Net
>          Issue Type: Task
>         Environment: Windows XP, Visual Studio 2003
>            Reporter: Jo Inge Arnes
>            Assignee: Digy
>         Attachments: test.patch
>
>
> At the end of the FastCharStream.Refill() method, it says:
> int charsRead = input.Read(buffer, newPosition, buffer.Length - newPosition);
> if (charsRead <= 0)
>    throw new System.IO.IOException("read past eof");
> else
>    bufferLength += charsRead;
> When I run Lucene in the debugger, this causes an exception to be thrown all the time.
> To me it looks like it is thrown as a result of a normal situation, not because of some critical error.
> Is this correct?
> If this is the case, then the code is horrible. Throwing an exception in .NET is extremely slow, and should never be thrown as a result of a normal situation. I repeat: "extremely slow"

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (LUCENENET-8) Throwing an exception as a result of a normal situation is extremely bad in .net

Posted by "George Aroush (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/LUCENENET-8?page=all ]

George Aroush reassigned LUCENENET-8:
-------------------------------------

    Assignee: George Aroush

> Throwing an exception as a result of a normal situation is extremely bad in .net
> --------------------------------------------------------------------------------
>
>                 Key: LUCENENET-8
>                 URL: http://issues.apache.org/jira/browse/LUCENENET-8
>             Project: Lucene.Net
>          Issue Type: Task
>         Environment: Windows XP, Visual Studio 2003
>            Reporter: Jo Inge Arnes
>         Assigned To: George Aroush
>         Attachments: test.patch
>
>
> At the end of the FastCharStream.Refill() method, it says:
> int charsRead = input.Read(buffer, newPosition, buffer.Length - newPosition);
> if (charsRead <= 0)
>    throw new System.IO.IOException("read past eof");
> else
>    bufferLength += charsRead;
> When I run Lucene in the debugger, this causes an exception to be thrown all the time.
> To me it looks like it is thrown as a result of a normal situation, not because of some critical error.
> Is this correct?
> If this is the case, then the code is horrible. Throwing an exception in .NET is extremely slow, and should never be thrown as a result of a normal situation. I repeat: "extremely slow"

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

RE: [jira] Commented: (LUCENENET-8) Throwing an exception as a result of a normal situation is extremely bad in .net

Posted by Neil Carson <nc...@everdreamcorp.com>.
Hi George
 
You may want to really consider this one. We were running tests indexing a dozen or two fields, and making this change made Lucene.NET almost 100x faster indexing. Yes, really that order of magnitude from a simple change.
 
I'm not sure if that's the only place we changed... Mark?
 
    Neil

________________________________

From: George Aroush (JIRA) [mailto:jira@apache.org]
Sent: Tue 10/3/2006 6:42 PM
To: lucene-net-dev@incubator.apache.org
Subject: [jira] Commented: (LUCENENET-8) Throwing an exception as a result of a normal situation is extremely bad in .net



    [ http://issues.apache.org/jira/browse/LUCENENET-8?page=comments#action_12439702 ]
           
George Aroush commented on LUCENENET-8:
---------------------------------------

Hi,

I am all for making Lucene.Net faster.  At the same time, I want to preserve the compatibility of Lucene.Net with it's Java version..  If this throw was introduced in the .Net version only, then I would have made the change, but it's not -- Java Lucene has the same code.

I will post this JIRA issue to the Java mailing list and see what they have to say about it.  Who knows, they agree that it should be removed.

Regards,

-- George Aroush

> Throwing an exception as a result of a normal situation is extremely bad in .net
> --------------------------------------------------------------------------------
>
>                 Key: LUCENENET-8
>                 URL: http://issues.apache.org/jira/browse/LUCENENET-8
>             Project: Lucene.Net
>          Issue Type: Task
>         Environment: Windows XP, Visual Studio 2003
>            Reporter: Jo Inge Arnes
>         Attachments: test.patch
>
>
> At the end of the FastCharStream.Refill() method, it says:
> int charsRead = input.Read(buffer, newPosition, buffer.Length - newPosition);
> if (charsRead <= 0)
>    throw new System.IO.IOException("read past eof");
> else
>    bufferLength += charsRead;
> When I run Lucene in the debugger, this causes an exception to be thrown all the time.
> To me it looks like it is thrown as a result of a normal situation, not because of some critical error.
> Is this correct?
> If this is the case, then the code is horrible. Throwing an exception in .NET is extremely slow, and should never be thrown as a result of a normal situation. I repeat: "extremely slow"

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



[jira] Commented: (LUCENENET-8) Throwing an exception as a result of a normal situation is extremely bad in .net

Posted by "George Aroush (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/LUCENENET-8?page=comments#action_12439702 ] 
            
George Aroush commented on LUCENENET-8:
---------------------------------------

Hi,

I am all for making Lucene.Net faster.  At the same time, I want to preserve the compatibility of Lucene.Net with it's Java version..  If this throw was introduced in the .Net version only, then I would have made the change, but it's not -- Java Lucene has the same code.

I will post this JIRA issue to the Java mailing list and see what they have to say about it.  Who knows, they agree that it should be removed.

Regards,

-- George Aroush

> Throwing an exception as a result of a normal situation is extremely bad in .net
> --------------------------------------------------------------------------------
>
>                 Key: LUCENENET-8
>                 URL: http://issues.apache.org/jira/browse/LUCENENET-8
>             Project: Lucene.Net
>          Issue Type: Task
>         Environment: Windows XP, Visual Studio 2003
>            Reporter: Jo Inge Arnes
>         Attachments: test.patch
>
>
> At the end of the FastCharStream.Refill() method, it says:
> int charsRead = input.Read(buffer, newPosition, buffer.Length - newPosition);
> if (charsRead <= 0)
>    throw new System.IO.IOException("read past eof");
> else
>    bufferLength += charsRead;
> When I run Lucene in the debugger, this causes an exception to be thrown all the time.
> To me it looks like it is thrown as a result of a normal situation, not because of some critical error.
> Is this correct?
> If this is the case, then the code is horrible. Throwing an exception in .NET is extremely slow, and should never be thrown as a result of a normal situation. I repeat: "extremely slow"

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (LUCENENET-8) Throwing an exception as a result of a normal situation is extremely bad in .net

Posted by "Joe Shaw (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/LUCENENET-8?page=comments#action_12442687 ] 
            
Joe Shaw commented on LUCENENET-8:
----------------------------------

As pointed out later in the linked thread, LUCENE-388 is *not* the same issue as this one.  And that issue still exists in the Java version as well (where throwing exceptions for normal flow is also very bad)

> Throwing an exception as a result of a normal situation is extremely bad in .net
> --------------------------------------------------------------------------------
>
>                 Key: LUCENENET-8
>                 URL: http://issues.apache.org/jira/browse/LUCENENET-8
>             Project: Lucene.Net
>          Issue Type: Task
>         Environment: Windows XP, Visual Studio 2003
>            Reporter: Jo Inge Arnes
>         Assigned To: George Aroush
>         Attachments: test.patch
>
>
> At the end of the FastCharStream.Refill() method, it says:
> int charsRead = input.Read(buffer, newPosition, buffer.Length - newPosition);
> if (charsRead <= 0)
>    throw new System.IO.IOException("read past eof");
> else
>    bufferLength += charsRead;
> When I run Lucene in the debugger, this causes an exception to be thrown all the time.
> To me it looks like it is thrown as a result of a normal situation, not because of some critical error.
> Is this correct?
> If this is the case, then the code is horrible. Throwing an exception in .NET is extremely slow, and should never be thrown as a result of a normal situation. I repeat: "extremely slow"

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (LUCENENET-8) Throwing an exception as a result of a normal situation is extremely bad in .net

Posted by "Doug (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENENET-8?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12478951 ] 

Doug commented on LUCENENET-8:
------------------------------

This project has always followed the ideal of being a direct port of Java Lucene, and while the project is in its infancy, I think it would be better to stay that way.

By nature of the project, anyone interested in the issues is free to apply patches to their own installations. And this is definitely the place to discuss those issues, but as for changing the direction of the core project, I think thats better left to when there are many more active members contributing.

Perhaps then it will be time for a branch to be maintained by enthusiastic volunteers prepared to invest the time in creating releases more independent of the Java project, one that follows .Net best practices and conventions. 

For now I think the project needs to maintain course. IMO of course!

> Throwing an exception as a result of a normal situation is extremely bad in .net
> --------------------------------------------------------------------------------
>
>                 Key: LUCENENET-8
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-8
>             Project: Lucene.Net
>          Issue Type: Task
>         Environment: Windows XP, Visual Studio 2003
>            Reporter: Jo Inge Arnes
>         Assigned To: George Aroush
>         Attachments: test.patch
>
>
> At the end of the FastCharStream.Refill() method, it says:
> int charsRead = input.Read(buffer, newPosition, buffer.Length - newPosition);
> if (charsRead <= 0)
>    throw new System.IO.IOException("read past eof");
> else
>    bufferLength += charsRead;
> When I run Lucene in the debugger, this causes an exception to be thrown all the time.
> To me it looks like it is thrown as a result of a normal situation, not because of some critical error.
> Is this correct?
> If this is the case, then the code is horrible. Throwing an exception in .NET is extremely slow, and should never be thrown as a result of a normal situation. I repeat: "extremely slow"

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LUCENENET-8) Throwing an exception as a result of a normal situation is extremely bad in .net

Posted by "Marco Dissel (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/LUCENENET-8?page=comments#action_12441660 ] 
            
Marco Dissel commented on LUCENENET-8:
--------------------------------------

Is is an option to skip the 2.0 release and sync with the trunk version of the 2.0.1 java edition? 

I think the performance boost is enough reason to skip and move to the 2.0.1 release..

Thanks
Marco

> Throwing an exception as a result of a normal situation is extremely bad in .net
> --------------------------------------------------------------------------------
>
>                 Key: LUCENENET-8
>                 URL: http://issues.apache.org/jira/browse/LUCENENET-8
>             Project: Lucene.Net
>          Issue Type: Task
>         Environment: Windows XP, Visual Studio 2003
>            Reporter: Jo Inge Arnes
>         Assigned To: George Aroush
>         Attachments: test.patch
>
>
> At the end of the FastCharStream.Refill() method, it says:
> int charsRead = input.Read(buffer, newPosition, buffer.Length - newPosition);
> if (charsRead <= 0)
>    throw new System.IO.IOException("read past eof");
> else
>    bufferLength += charsRead;
> When I run Lucene in the debugger, this causes an exception to be thrown all the time.
> To me it looks like it is thrown as a result of a normal situation, not because of some critical error.
> Is this correct?
> If this is the case, then the code is horrible. Throwing an exception in .NET is extremely slow, and should never be thrown as a result of a normal situation. I repeat: "extremely slow"

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (LUCENENET-8) Throwing an exception as a result of a normal situation is extremely bad in .net

Posted by "Fabio Buscaroli (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/LUCENENET-8?page=comments#action_12420858 ] 

Fabio Buscaroli commented on LUCENENET-8:
-----------------------------------------

i agree, and i would address also the implementation of FieldInfos.FieldName(int fieldNumber).

this is the original method implementation
try 
{
return FieldInfo(fieldNumber).name;
 }
catch (System.NullReferenceException)
{
return "";
}

fieldNumber is -1 when the indexread does the first read. i have a web application and indexreader are open and disponed frequently so, this kind of exception occurs at any search.

this simple code would solve the problem:

public System.String FieldName(int fieldNumber)
{
if (fieldNumber != -1)
{
try
{
    return FieldInfo(fieldNumber).name;
}
catch (System.NullReferenceException)
{
    return String.Empty;
}
}

return String.Empty;
}



> Throwing an exception as a result of a normal situation is extremely bad in .net
> --------------------------------------------------------------------------------
>
>          Key: LUCENENET-8
>          URL: http://issues.apache.org/jira/browse/LUCENENET-8
>      Project: Lucene.Net
>         Type: Task

>  Environment: Windows XP, Visual Studio 2003
>     Reporter: Jo Inge Arnes

>
> At the end of the FastCharStream.Refill() method, it says:
> int charsRead = input.Read(buffer, newPosition, buffer.Length - newPosition);
> if (charsRead <= 0)
>    throw new System.IO.IOException("read past eof");
> else
>    bufferLength += charsRead;
> When I run Lucene in the debugger, this causes an exception to be thrown all the time.
> To me it looks like it is thrown as a result of a normal situation, not because of some critical error.
> Is this correct?
> If this is the case, then the code is horrible. Throwing an exception in .NET is extremely slow, and should never be thrown as a result of a normal situation. I repeat: "extremely slow"

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (LUCENENET-8) Throwing an exception as a result of a normal situation is extremely bad in .net

Posted by "George Aroush (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/LUCENENET-8?page=comments#action_12441033 ] 
            
George Aroush commented on LUCENENET-8:
---------------------------------------

Hi folks,

I have submitted this issue as a question to the Java Lucene folks (you can see the email thread about it here: http://mail-archives.apache.org/mod_mbox/lucene-java-dev/200610.mbox/date (scan for FastCharStream.refill as the email subject.)

It turned out that this is an issue for Java Lucene as well and it has been fixed for 2.0.1 (see: https://issues.apache.org/jira/browse/LUCENE-388)

Given that Java Lucene 2.0.1 is not officially released, and that I am still trying to get Lucene.Net 2.0 out, I will hold off doing any work on this issue.

I would add, once 2.0.1 is officially released, this change will be part of Lucene.Net 2.0.1, automatically.

Thanks.

-- George Aroush

> Throwing an exception as a result of a normal situation is extremely bad in .net
> --------------------------------------------------------------------------------
>
>                 Key: LUCENENET-8
>                 URL: http://issues.apache.org/jira/browse/LUCENENET-8
>             Project: Lucene.Net
>          Issue Type: Task
>         Environment: Windows XP, Visual Studio 2003
>            Reporter: Jo Inge Arnes
>         Assigned To: George Aroush
>         Attachments: test.patch
>
>
> At the end of the FastCharStream.Refill() method, it says:
> int charsRead = input.Read(buffer, newPosition, buffer.Length - newPosition);
> if (charsRead <= 0)
>    throw new System.IO.IOException("read past eof");
> else
>    bufferLength += charsRead;
> When I run Lucene in the debugger, this causes an exception to be thrown all the time.
> To me it looks like it is thrown as a result of a normal situation, not because of some critical error.
> Is this correct?
> If this is the case, then the code is horrible. Throwing an exception in .NET is extremely slow, and should never be thrown as a result of a normal situation. I repeat: "extremely slow"

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (LUCENENET-8) Throwing an exception as a result of a normal situation is extremely bad in .net

Posted by "Asgeir Halldorsson (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/LUCENENET-8?page=all ]

Asgeir Halldorsson updated LUCENENET-8:
---------------------------------------

    Attachment: test.patch

I made a small test. See attached patch.  (NOTE:  Not tested fully)
And it seams removing the exception in refill makes indexing time 50% less.

I created a small test app that created 1024 docs with 1 filed.  Filled with Guid.  And the indextimer was just over 14sec after patch about 10sec

> Throwing an exception as a result of a normal situation is extremely bad in .net
> --------------------------------------------------------------------------------
>
>                 Key: LUCENENET-8
>                 URL: http://issues.apache.org/jira/browse/LUCENENET-8
>             Project: Lucene.Net
>          Issue Type: Task
>         Environment: Windows XP, Visual Studio 2003
>            Reporter: Jo Inge Arnes
>         Attachments: test.patch
>
>
> At the end of the FastCharStream.Refill() method, it says:
> int charsRead = input.Read(buffer, newPosition, buffer.Length - newPosition);
> if (charsRead <= 0)
>    throw new System.IO.IOException("read past eof");
> else
>    bufferLength += charsRead;
> When I run Lucene in the debugger, this causes an exception to be thrown all the time.
> To me it looks like it is thrown as a result of a normal situation, not because of some critical error.
> Is this correct?
> If this is the case, then the code is horrible. Throwing an exception in .NET is extremely slow, and should never be thrown as a result of a normal situation. I repeat: "extremely slow"

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira