You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@stdcxx.apache.org by "Travis Vitek (JIRA)" <ji...@apache.org> on 2008/05/03 02:58:55 UTC

[jira] Created: (STDCXX-907) messages::do_get() inefficiency requires unnecessary locking

messages<charT>::do_get() inefficiency requires unnecessary locking
-------------------------------------------------------------------

                 Key: STDCXX-907
                 URL: https://issues.apache.org/jira/browse/STDCXX-907
             Project: C++ Standard Library
          Issue Type: Bug
          Components: 22. Localization
    Affects Versions: 4.2.1
            Reporter: Travis Vitek
            Priority: Minor
             Fix For: 4.3


The _STD::messages<T>::do_get() method might actually call __rw_manage_cat_data() up to three times to access the cache. Since each access involves a mutex lock, there are going to be some wasted cycles. It would be nice to reduce this to one access. Perhaps the _RW::__rw_get_message() function could be changed to fill in a pointer to the _STD::locale that is kept in the cache and the _RW::__rw_get_locale() function could be removed.

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


[jira] Commented: (STDCXX-907) messages::do_get() inefficiency requires unnecessary locking

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/STDCXX-907?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12594273#action_12594273 ] 

Martin Sebor commented on STDCXX-907:
-------------------------------------

I'm wondering if {{__rw_get_message()}} is actually exposed in the library's ABI given that the facet template has only two possible specializations and they are both instantiated in the library. If not, we could make the change without keeping the old signature around.

Btw., I'm not sure using the version macro this way is the best approach for the library (then again, I'm not sure it isn't, either). Would adding an {{#else}} block along these lines be a better way of guaranteeing that the code does in fact get removed?
{noformat}
#else
#  error "remove me!"
#endif
{noformat}

As for the signature of the new overload, FWIW, my personal preference is for the convention where objects are passed by reference as ??in?? parameters and by their address as ??out?? parameters. That way it's usually more clear at the call site that the object will be modified. I.e.,
{noformat}
@@ -61,16 +61,20 @@
                           int                    __msgid,
                           const string_type     &__dfault) const
 {
-    const char* const __text = _RW::__rw_get_message (__cat, __set, __msgid);
- 
+    const _STD::locale* __ploc;   // will be set in __rw_get_message()
+
+    const char* const __text = _RW::__rw_get_message (__cat, __set, __msgid, &__ploc);
     if (__text) {
{noformat}


> messages<charT>::do_get() inefficiency requires unnecessary locking
> -------------------------------------------------------------------
>
>                 Key: STDCXX-907
>                 URL: https://issues.apache.org/jira/browse/STDCXX-907
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 22. Localization
>    Affects Versions: 4.2.1
>            Reporter: Travis Vitek
>            Assignee: Travis Vitek
>            Priority: Minor
>             Fix For: 4.3
>
>         Attachments: stdcxx-907.patch
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> The {{_STD::messages<T>::do_get()}} method might actually call {{\_\_rw_manage_cat_data()}} up to three times to access the cache. Since each access involves a mutex lock, there are going to be some wasted cycles. It would be nice to reduce this to one access. Perhaps the {{_RW::\_\_rw_get_message()}} function could be changed to fill in a pointer to the {{_STD::locale}} that is kept in the cache and the {{_RW::\_\_rw_get_locale()}} function could be removed.
> For backward binary compatibility we would need to keep the existing functions around, but we could add an overload and then deprecate the old ones using the {{_RWSTD_VER}} macro.

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


[jira] Updated: (STDCXX-907) messages::do_get() inefficiency requires unnecessary locking

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

Travis Vitek updated STDCXX-907:
--------------------------------

    Attachment: stdcxx-907.patch

The proposed patch assumes that the patch for STDCXX-845 was applied. It should still work without that patch, but I haven't tested it.

{noformat}
2008-05-02  Travis Vitek  <vi...@roguewave.com>

	STDCXX-845
	* src/messages.cpp (__rw_get_message): Add overload which takes a
	pointer reference, allowing us to get the message and the locale
	in a single function call to avoid some unnecessary locking.
	(__rw_get_message, __rw_get_locale) [_RWSTD_VER]: Conditionally
	deprecate old functions to be sure they are removed in 5.0
{noformat}

> messages<charT>::do_get() inefficiency requires unnecessary locking
> -------------------------------------------------------------------
>
>                 Key: STDCXX-907
>                 URL: https://issues.apache.org/jira/browse/STDCXX-907
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 22. Localization
>    Affects Versions: 4.2.1
>            Reporter: Travis Vitek
>            Priority: Minor
>             Fix For: 4.3
>
>         Attachments: stdcxx-907.patch
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> The {{_STD::messages<T>::do_get()}} method might actually call {{\_\_rw_manage_cat_data()}} up to three times to access the cache. Since each access involves a mutex lock, there are going to be some wasted cycles. It would be nice to reduce this to one access. Perhaps the {{_RW::\_\_rw_get_message()}} function could be changed to fill in a pointer to the {{_STD::locale}} that is kept in the cache and the {{_RW::\_\_rw_get_locale()}} function could be removed.
> For backward binary compatibility we would need to keep the existing functions around, but we could add an overload and then deprecate the old ones using the {{_RWSTD_VER}} macro.

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


[jira] Updated: (STDCXX-907) messages::do_get() inefficiency requires unnecessary locking

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

Travis Vitek updated STDCXX-907:
--------------------------------

    Description: 
The {{_STD::messages<T>::do_get()}} method might actually call {{\_\_rw_manage_cat_data()}} up to three times to access the cache. Since each access involves a mutex lock, there are going to be some wasted cycles. It would be nice to reduce this to one access. Perhaps the {{_RW::\_\_rw_get_message()}} function could be changed to fill in a pointer to the {{_STD::locale}} that is kept in the cache and the {{_RW::\_\_rw_get_locale()}} function could be removed.

For backward binary compatibility we would need to keep the existing functions around, but we could add an overload and then deprecate the old ones using the {{_RWSTD_VER}} macro.

  was:The _STD::messages<T>::do_get() method might actually call __rw_manage_cat_data() up to three times to access the cache. Since each access involves a mutex lock, there are going to be some wasted cycles. It would be nice to reduce this to one access. Perhaps the _RW::__rw_get_message() function could be changed to fill in a pointer to the _STD::locale that is kept in the cache and the _RW::__rw_get_locale() function could be removed.


> messages<charT>::do_get() inefficiency requires unnecessary locking
> -------------------------------------------------------------------
>
>                 Key: STDCXX-907
>                 URL: https://issues.apache.org/jira/browse/STDCXX-907
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 22. Localization
>    Affects Versions: 4.2.1
>            Reporter: Travis Vitek
>            Priority: Minor
>             Fix For: 4.3
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> The {{_STD::messages<T>::do_get()}} method might actually call {{\_\_rw_manage_cat_data()}} up to three times to access the cache. Since each access involves a mutex lock, there are going to be some wasted cycles. It would be nice to reduce this to one access. Perhaps the {{_RW::\_\_rw_get_message()}} function could be changed to fill in a pointer to the {{_STD::locale}} that is kept in the cache and the {{_RW::\_\_rw_get_locale()}} function could be removed.
> For backward binary compatibility we would need to keep the existing functions around, but we could add an overload and then deprecate the old ones using the {{_RWSTD_VER}} macro.

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


[jira] Updated: (STDCXX-907) messages::do_get() inefficiency requires unnecessary locking

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

Travis Vitek updated STDCXX-907:
--------------------------------

    Patch Info: [Patch Available]

> messages<charT>::do_get() inefficiency requires unnecessary locking
> -------------------------------------------------------------------
>
>                 Key: STDCXX-907
>                 URL: https://issues.apache.org/jira/browse/STDCXX-907
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 22. Localization
>    Affects Versions: 4.2.1
>            Reporter: Travis Vitek
>            Assignee: Travis Vitek
>            Priority: Minor
>             Fix For: 4.3.0
>
>         Attachments: stdcxx-907.patch
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> The {{_STD::messages<T>::do_get()}} method might actually call {{\_\_rw_manage_cat_data()}} up to three times to access the cache. Since each access involves a mutex lock, there are going to be some wasted cycles. It would be nice to reduce this to one access. Perhaps the {{_RW::\_\_rw_get_message()}} function could be changed to fill in a pointer to the {{_STD::locale}} that is kept in the cache and the {{_RW::\_\_rw_get_locale()}} function could be removed.
> For backward binary compatibility we would need to keep the existing functions around, but we could add an overload and then deprecate the old ones using the {{_RWSTD_VER}} macro.

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


[jira] Assigned: (STDCXX-907) messages::do_get() inefficiency requires unnecessary locking

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

Travis Vitek reassigned STDCXX-907:
-----------------------------------

    Assignee: Travis Vitek

> messages<charT>::do_get() inefficiency requires unnecessary locking
> -------------------------------------------------------------------
>
>                 Key: STDCXX-907
>                 URL: https://issues.apache.org/jira/browse/STDCXX-907
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 22. Localization
>    Affects Versions: 4.2.1
>            Reporter: Travis Vitek
>            Assignee: Travis Vitek
>            Priority: Minor
>             Fix For: 4.3
>
>         Attachments: stdcxx-907.patch
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> The {{_STD::messages<T>::do_get()}} method might actually call {{\_\_rw_manage_cat_data()}} up to three times to access the cache. Since each access involves a mutex lock, there are going to be some wasted cycles. It would be nice to reduce this to one access. Perhaps the {{_RW::\_\_rw_get_message()}} function could be changed to fill in a pointer to the {{_STD::locale}} that is kept in the cache and the {{_RW::\_\_rw_get_locale()}} function could be removed.
> For backward binary compatibility we would need to keep the existing functions around, but we could add an overload and then deprecate the old ones using the {{_RWSTD_VER}} macro.

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