Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-8177

Remove Lex_input_stream::m_cpp_buf

    XMLWordPrintable

Details

    Description

      We can try to get rid of all m_cpp_xxx members in Lex_input_stream.
      It seems that the main purpose for these members is to cut comments from SELECT list item names:

      MariaDB [test]> SELECT 1 /* +2 */ + 3;
      +--------+
      | 1  + 3 |
      +--------+
      |      4 |
      +--------+
      1 row in set (4.69 sec)

      Notice, the column name does not include the comment part.

      The current code copies the original query into m_cpp_buf (removing comments on the way), so the second copy of the original query is always created. This affects performance negatively.

      Moreover, in most cases queries do not have comments at all.

      Related pieces of the code:

        void skip_binary(int n)
        {
          if (m_echo)
          {
            memcpy(m_cpp_ptr, m_ptr, n);
            m_cpp_ptr += n;
          }
          m_ptr += n;
        }
       
       ...
       
       
        unsigned char yyGet()
        {  
          char c= *m_ptr++;
          if (m_echo)
            *m_cpp_ptr++ = c;
          return c;  
        }
       
        ...
        void yySkipn(int n)
        {
          if (m_echo)
          {
            memcpy(m_cpp_ptr, m_ptr, n);
            m_cpp_ptr += n;
          }
          m_ptr += n;
        }
       

      Attachments

        Activity

          People

            Unassigned Unassigned
            bar Alexander Barkov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.